Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Fixed or Sticky header or ASP.NET webpage

0.00/5 (No votes)
19 Dec 2010 1  
Fixed or Sticky header or ASP.NET webpage
If you want the header section of the website to be fixed on top with menus and other information, you can simply use the below CSS to do so:

CSS
.header
{
    background-color:Gray;
    width:100%;
    height:100px;
    position:fixed;
    top:0px;
    margin:0px;
    padding:0px;
}

body
{
    padding-top:110px;
    margin:0px;
}


Use it like:

HTML
<div class="header">
       Header content goes here...
</div>
<div>
       Body content goes here...
</div>


This can be used with Master pages too.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here