Search code examples
htmlcssheaderfreeze

How to freeze header of the page


My web template is based on div tags. I want to freeze header part (Header, logo etc), I mean when you scroll the page the header should be in fixed position.

 <!--Header and Logo -->
 <div id="outer">
 <div id="header">
   <h1><a href="#">Some Application</a></h1>
   <img src="/media/images/logo.gif"  height="95" width="190">
 </div>

Here is my css

#outer
{

}
/* Header */
#header
 {
height: 95px;
background-image: url();
background-repeat:no-repeat;
background-position: bottom left;
padding-left: 20px;
padding-top: 15px;
padding-bottom: 15px;
}

Can some one help me? Thanks


Solution

  • Try using the position: fixed; property. Here is an example fiddle: http://jsfiddle.net/austinbv/2KTFG/