html - How do I make my footer go down as I add content? -


i structured site this:

<body>     <div class="main">        <div class="header">           content       </div>         <div class="section">          content       </div>        <div class="sidebar">          content       </div>        <div class="clearing"></div>        <div class="footer">          content       </div>    </div> </body> 

and css

.main {         position:relative;         width:908px;         margin-top:0px;         border:solid 0px;         margin:0 auto;     }  .header {          position:relative;         height:200px;         margin: auto;     }     div.section {             float:left;         position:absolute;         width: 584px;         height:500px;         margin-top: 0px;         margin-left: auto;         margin-right: auto;         text-align:left;         }    div.sidebar{         float:right;         position:relative;         width: 324px;         height:500px;         margin-top: 0px;         margin-left: auto;         margin-right: auto;         text-align:left;      }     .clearing {          clear:both;     }       .footer {     position:relative;     left:0px;     top:0px;     width:908px;     height:300px;    } 

when add content div section, goes on footer. footer fixed @ point, , content added, page grows , footer remains still.

what have everytime add content increase in css file either height of section or height of sidebar - either 1 work - increase both heights (section , sidebar) same value, because seems right thing do. footer pushed down height of section , sidebar grows.

however, if atribute height content add section, not have effect on position of footer, perhaps because has nothing height of section itself.

is there way make footer respond space content being added occupy, , automatically move along, remaining @ bottom of page ?

you have position:absolute set on .section div, ever use css height value amount of space takes up, regardless of actual content. removing absolute position should solve problems. there's (almost) way around absolute positioning. in example, seems unnecessary.

here's helpful site css positioning: http://www.barelyfitz.com/screencast/html-training/css/positioning/

hope helps!


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -