Back

Make a game website · Templates

Starter templates

Copy a small snippet and adapt its paths, content, and visual style to your own project.

These small starting points are yours to adapt. Copy a snippet, replace the example names and colors, and save it in your project. They are plain HTML/CSS and do not include game files.

One-page home

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <title>My Game Shelf</title>
  <style>
    body { max-width: 52rem; margin: 3rem auto; padding: 0 1rem; font: 1rem/1.6 system-ui, sans-serif; }
    a { color: #6242b5; }
  </style>
</head>
<body>
  <main>
    <p>MY COLLECTION</p>
    <h1>My Game Shelf</h1>
    <p>A short introduction to this site.</p>
    <a href="games.html">Browse games →</a>
  </main>
</body>
</html>

Accessible game card

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

<style>
  .game-card { display: grid; gap: .6rem; color: inherit; text-decoration: none; }
  .game-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: .8rem; }
  .game-card:focus-visible { outline: 3px solid #6242b5; outline-offset: 4px; }
</style>

Simple mobile-friendly game frame

Only embed a game if you have permission to host or embed it. Some games require a different sandbox or browser features; check their documentation before using this pattern.

<main>
  <h1>Sample Game</h1>
  <div class="game-frame">
    <iframe src="../games/sample-game/index.html" title="Sample Game" allow="fullscreen; autoplay" allowfullscreen></iframe>
  </div>
</main>

<style>
  .game-frame { aspect-ratio: 16 / 9; min-height: 320px; }
  .game-frame iframe { width: 100%; height: 100%; border: 0; }
</style>
The frame’s src is relative to the page that contains it. Adjust the number of ../ path segments to match your folder structure.