codegurukool.com · Free coding tutorials & online compiler

Home › HTML Tutorial › HTML layout

HTML layout

Arrange a page in regions.

Combine semantic elements with CSS grid or flexbox for header, navigation, main content, sidebar and footer.

Example code

<style>
.p{display:grid;grid-template:auto 1fr auto / 120px 1fr;gap:6px;height:240px}
.p>*{background:#dde;padding:8px}.h,.f{grid-column:1/3}
</style>
<div class='p'><header class='h'>Header</header><nav>Nav</nav><main>Main</main><footer class='f'>Footer</footer></div>'

Run this code in the online editor

← HTML head and metaHTML responsive →