htmlcssz-indexpositioning

Prevent an element from covering another


I have a fixed header. As I scroll, certain elements cover the header. How do I prevent this?


Solution

  • You should set the z-index for the divs:

    #headercontainer {
        z-index:1;
    }
    #contentcontainer {
        z-index:-1;
    }
    

    Adding the above lines should give your header priority over the content container.