开发者

div rendering outside container

I've started a template on a page and for some reason one of my DIVs (#content) is rendering outside the main "container" div. I've looked and looked and can't find anything is there anything wrong with my code?

Thanks in advance.

Kiz

CSS:

#container {
width:1000px;
margin:0 auto;
background-color:#000;
}

#top {
height:100px;
margin:0px 0px 50px 0px;
background-color:#F00;
}

#navigation {
width:720px;
height:100px;
float:left;
background-co开发者_运维技巧lor:#0F0;
}

#logo {
width:180px;
height:100px;
float:right;
background-color:#00F;
}

.clear {
clear:both;
}

#content {
margin:0 auto;
background-color:#FF0;
}

And here's the HTML:

<div id="container">
  <div id="top">
    <div id="navigation">Navigation goes here</div>
    <div id="logo">Logo</div>
    <div class="clear" />
  </div>
  <div id="content">Content goes here
  </div>
</div>


#container {
overflow: auto;
}


Ok the issue seemed to be that your clear: both; elements were unclosed div's. Should have been br tags. So basically, that seemed to solved most of the stuff. Thou not sure, why the #top should be set height: 100px;, if the elements inside set the height anyway..even though they are floating.. then will set the ending.

Fiddle: http://jsfiddle.net/hobobne/qxYHN/1/


I got this error too and mine problem was a extra closing div so i removed that and it fixed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜