css - 子 float Div 脱离父 Div

标签 css html css-float

我在这里阅读了很多关于这个问题的其他帖子,但没有任何效果。我希望背景图片延伸到整个页面的长度,但它只向下延伸了 2/3。

html, body { height: 100%; }

div#body-wrapper {
   height:100%;
   position:relative;
}

nav#side-navigation {
   height:100%;
   width:185px;
   background-color:#C2F4C2;
   float:left;
}

div#content-wrap {
   width:775px;
   height:100%;
   float:right;
   position:relative;
   background:transparent url(../images/global/column_corner.gif) no-repeat top left;
}

如果我将 overflow:hidden 添加到 #body-wrapper,它会切断网站底部的一部分。

最后,这是有效的源代码:http://freshbaby.com/v20/about_us/index.cfm

最佳答案

您可以在 float 元素之后添加一个元素来“清除” float 。

<div style="clear:both"></div>

关于css - 子 float Div 脱离父 Div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9844982/

相关文章:

php - 如何链接 HTML 下拉列表

Javascript getElementbyId.value 不返回任何值

css - GWT - 第一步 - Div+label+css 样式

html - 我应该如何根据行悬停切换操作链接

html - 我的边框底边被切断

python - 使用 python 脚本在 apache2 上不通过 SSL 显示图像

javascript - 使用两个链接显示或隐藏特定 div 的可见性

javascript - 如何在父div中水平居中多个div

CSS float 砌体

html - 现代网页设计中的CSS布局