Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Content pass over a fixed header

Tags:

html

css

In my html page, i fixed my header with :

position : fixed

When i scroll down, then content of my page pass over the header. How can i fix this?

like image 541
Anas Avatar asked Dec 10 '22 01:12

Anas


1 Answers

Assuming your HTML is the following:

<div id="header">...</div>
<div id="content">...</div>

Try the following CSS:

<style type="text/css">
  #header {
    position:fixed;
    z-index:1;
  }
  #content {
    position:relative;
    z-index:2;
  }
 </style>
like image 182
Lior Cohen Avatar answered Jan 08 '23 05:01

Lior Cohen