Thursday, December 23, 2010

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:

        .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:

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

</div> <div>
Body content goes here...
</div>

This can be used with Master pages too.

No comments :

Post a Comment