Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

You can build a convincing YouTube-style homepage with plain HTML and CSS: a top bar, a navigation sidebar, and a responsive grid of video cards. The result is a static visual layout. It looks like a video homepage, but search, account menus, and recommendations do nothing until you add JavaScript and data, and the project does not become a working video service.

What you will build, and what stays static

The finished page has three regions and a repeated preview component. Everything else is presentation, which keeps the project focused on the skills it teaches: document structure, layout with Flexbox and CSS Grid, and responsive adjustments with media queries.

  • In scope: a header with a logo, a search-shaped field, and an avatar placeholder; a left navigation list; a main area with video cards; and a layout that adapts to narrow screens.
  • Out of scope without extra code: working search, a collapsible sidebar, real video files, personalized recommendations, and sign-in.

Step 1: Separate the page into regions

Start with the document structure before any styling. MDN’s guide to structuring documents describes header, navigation, and main content as common page regions, and HTML’s semantic elements (header, nav, main) name those regions so the markup says what each block is for. CSS then decides how they look and where they sit.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The header

The header holds the logo, the search control, and the account placeholder. Use a div with an input type="search" rather than a form for the search box. A form without an action submits back to the same page when someone presses Enter, which reloads the page and looks like a bug in a visual mockup.

#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

The navigation sidebar

The sidebar is a nav element containing a plain list of links. Keep the links as real anchors, even if they point to # for now, so keyboard focus and screen readers behave sensibly.

The main content

The main region holds the category labels and the video grid. Add a main element with one visible or visually hidden h1, and group the cards in a section with an accessible label.

Here is a minimal skeleton. The card is shown once; repeat it eight times or so to test wrapping.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Video Home Clone</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header class="top-bar">
    <button class="menu-btn" type="button" aria-label="Toggle menu">&#9776;</button>
    <div class="logo">PlayTube</div>
    <div class="search">
      <label for="q" class="visually-hidden">Search</label>
      <input id="q" type="search" placeholder="Search">
    </div>
    <div class="avatar" role="img" aria-label="Sample profile">A</div>
  </header>
  <div class="layout">
    <nav class="sidebar" aria-label="Main">
      <ul>
        <li><a href="#">Home</a></li>
        <li><a href="#">Shorts</a></li>
        <li><a href="#">Subscriptions</a></li>
      </ul>
    </nav>
    <main class="content">
      <h1 class="visually-hidden">Home</h1>
      <section class="grid" aria-label="Video previews">
        <article class="card">
          <div class="thumb">Sample thumbnail</div>
          <h3 class="title">Sample video title</h3>
          <p class="channel">Sample Channel</p>
          <p class="stats">1.2K views · 3 days ago</p>
        </article>
      </section>
    </main>
  </div>
</body>
</html>

Step 2: Keep the video card structure consistent

Every card should use the same four parts, in the same order: a thumbnail area, a title, a channel name, and optional metadata such as view count and age. Because the grid repeats this block, one inconsistent card, such as a title wrapped in a different element, creates uneven rows. Use placeholder thumbnails or images you have permission to use. The thumbnail is a fixed-ratio box so every card aligns, whatever the image.

Step 3: Lay out the header and the grid

Use Flexbox and CSS Grid for different jobs. Flexbox arranges items in one direction, which suits the header row and the sidebar links. CSS Grid arranges items in rows and columns, which suits a gallery of equal-width cards. Published clone examples commonly combine these two in the same way, though that is an implementation choice rather than a requirement.

* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, sans-serif; color: #0f0f0f; }

.top-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  padding: 8px 16px;
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
}
.logo { font-weight: 700; white-space: nowrap; }
.search { flex: 1; max-width: 560px; margin: 0 auto; }
.search input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
}
.avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #6b7280;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layout { display: flex; }
.sidebar {
  flex: 0 0 220px;
  padding: 12px;
  border-right: 1px solid #e5e5e5;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.sidebar a:hover { background: #f2f2f2; }

.content { flex: 1; min-width: 0; padding: 16px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px 12px;
}
.thumb {
  aspect-ratio: 16 / 9;
  background: #ddd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
}
.card { min-width: 0; }
.title { font-size: 15px; margin: 8px 0 4px; }
.channel, .stats { margin: 0; font-size: 13px; color: #606060; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

Two details prevent common layout faults. min-width: 0 on the content column lets it shrink inside the flex row instead of pushing the page wider than the screen. minmax(260px, 1fr) lets the grid add or remove columns as space changes without a media query for the card count.

Step 4: Make the layout adapt to smaller screens

Media queries change the arrangement when the viewport narrows. No standard breakpoint exists for this kind of page; the value below (800px) is a choice for this sample layout, and you should pick values that suit your own design.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A common shortcut is to hide the sidebar on small screens. That creates a problem: without JavaScript, nothing can reopen it, so phone users lose navigation. The version below keeps the links visible as a horizontally scrolling row instead.

@media (max-width: 800px) {
  .layout { flex-direction: column; }
  .sidebar {
    flex: none;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e5e5e5;
    padding: 8px 12px;
  }
  .sidebar ul { display: flex; gap: 8px; overflow-x: auto; }
  .sidebar a { white-space: nowrap; }
}

Check the page at narrow and wide sizes

  • Open the page at a wide width (about 1280px) and confirm the sidebar, header, and at least three card columns are visible.
  • Narrow the window toward 360px, the width of many phones, and confirm there is no horizontal scrollbar on the page itself. In Chrome or Edge, press Ctrl+Shift+M to open the device toolbar and test a set of sizes.
  • Check that the search field shrinks rather than pushing the avatar off the header row.
  • Check that thumbnails keep their 16:9 shape and that long titles wrap instead of overflowing the card.
  • Check that the sidebar links scroll sideways on narrow screens without clipping the first or last link.

The 16:9 ratio matches common landscape video previews. It is a reasonable example, not a rule the layout must follow.

What static HTML and CSS cannot do

A page with a search box and an avatar invites clicks that do nothing. The table below lists each visible element, what the markup and styles give you, and what you must add before the element behaves like a real feature.

Visible element What HTML and CSS provide What you must add for real behavior
Search field An input with placeholder text and styling JavaScript to read the query, plus a search service or data source to return results
Avatar and account area A styled circle with a letter An authentication system; nothing in the page manages accounts
Video cards and recommendations Fixed sample cards in the markup A data source for video metadata and a ranking method; cards in a static file are not personalized
Menu button A styled button with an accessible label JavaScript that toggles a class on the sidebar; without it, the button does nothing
Category labels and links Anchor elements that navigate to # Real routes or pages; the links only scroll to the top of the same page

When you are ready for interaction, JavaScript is the next layer. A toggle for the sidebar or a filter over the card list can start with a few lines of script. A working video service also needs real video data and server-side behavior, which is outside what a static clone can provide.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Branding and images

Google’s YouTube API Services Branding Guidelines, published on Google for Developers, state that a YouTube branding image should not be the most prominent element on a page and restrict how YouTube or its variants can appear in an application’s name. Those rules apply to applications using the API, and the page may change, so check the current guidance before you publish.

For a learning project, use original placeholder branding such as the name “PlayTube” in the example above, and avoid YouTube’s logo and wordmark unless you have an applicable basis for official assets. Use thumbnails and avatars you have permission to use, or generated placeholders.

Where to go next

  • Add interaction: write a small script that toggles a class on the sidebar, then filter the card list by a search term.
  • Test responsiveness on real devices: the device toolbar approximates screen sizes, but touch targets and font rendering differ on phones.
  • Compare with a published walkthrough: the freeCodeCamp HTML and CSS project on building a YouTube clone step by step, and a Class Central listing for a Web Dev Simplified tutorial on designing a YouTube clone, cover similar structure. Older walkthroughs may not match the current YouTube interface, so treat them as scope references rather than current design rules.

An iTechGuides guide, “How to Build a YouTube Homepage Clone with HTML and CSS,” dated October 4, 2026, sets out the same static limits covered here. A public CSS-only clone on GitHub by chamod-malindu, titled Youtube-Clone-html-css, is a useful reference for how the parts fit together once you have built your own version.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.