Back

Make a game website · Part 2

Part 2: Pages and game cards

Turn the starter page into a useful library with consistent links, images, and game folders.

1. Add a games page

Create games.html beside index.html. Add a navigation link on both pages so visitors can move around. Keep page names and links consistent.

<nav aria-label="Main navigation">
  <a href="index.html">Home</a>
  <a href="games.html" aria-current="page">Games</a>
</nav>
<main>
  <h1>Games</h1>
  <ul class="game-list">
    <li><a href="games/sample-game/index.html">Sample Game</a></li>
  </ul>
</main>

2. Make it readable on different screens

Put shared colors, spacing, and layout in styles.css. A small responsive layout can use CSS Grid and a viewport-aware width:

* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 system-ui, sans-serif; }
main { width: min(100% - 2rem, 960px); margin: 2rem auto; }
.game-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; padding: 0; list-style: none; }
.game-list a { display: block; padding: 1.25rem; border: 1px solid #777; border-radius: .75rem; }

3. Add a cover image with useful text

Store your cover image beside the game or in a shared image folder. Write alternative text that describes the image; if the image is purely decorative, use an empty alt value. Compress large images so the library loads quickly.

<a class="game-card" href="games/sample-game/index.html">
  <img src="images/sample-game.webp" alt="Colorful blocks from Sample Game">
  <span>Sample Game</span>
</a>

4. Put a game on its own page

If the game is a collection of files, keep its original folder structure intact. Point a card to the game’s entry page, usually its own index.html. A one-file game and a multi-file game are hosted differently: do not delete neighboring files that the entry page loads.

Before publishing, test every image, script, font, audio file, and level locally. Check the browser console and network panel for missing files (404 errors) and correct the path or filename.

5. Add small interactions carefully

JavaScript can power search, filters, or a theme switch. Start with a feature that works without JavaScript where possible, and keep the controls labelled for keyboard and screen-reader users. Never put passwords, private tokens, or service credentials in browser code.