Floating header

Report a typo

Create a webpage where a header always stays at the top, even when scrolling. Use relevant CSS property on the header and ensure the header overlaps other content by applying a high z-index: 100 value.

Write HTML and CSS code
<header>Fixed Header with z-index</header>
<div class="content">
<p>Scroll down to see the fixed header in action.</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>Content...</p>
<p>More content...</p>
</div>
Completed 0 of 2
Check if the header always stays at top.
Check if z-index value is present on header.

Create a free account to access the full topic