Skip to content
Justice Tech School

Page Layout

Most pages share the same parts: a header, a navigation bar, a main area (often with a sidebar) and a footer. Semantic elements name these parts, and CSS arranges them.

Flexbox and grid are the modern tools for layout. Do not use tables for layout.

Example
<style>
  body { margin: 0; font-family: sans-serif; }
  header, footer { background: #166534; color: white; padding: 12px; }
  .wrap { display: flex; }
  nav { background: #dcfce7; padding: 12px; width: 140px; }
  main { padding: 12px; flex: 1; }
</style>
<header>Site header</header>
<div class="wrap">
  <nav>Menu</nav>
  <main>Main content goes here.</main>
</div>
<footer>Footer</footer>

Exercise

Put children side by side.

.wrap { display: ; }

Quiz Test

Which should you avoid for page layout?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.