我依靠 CSS 属性overflow:hidden来包含 3 个嵌套 & 浮动divs。overflow:hidden应用于此 html 的父级div。
当我不使用时,overflow:hidden我的 lastdiv在一行 float 中不合适div,但是当我使用时overflow:hidden,整个div结构向下移动。
希望有人能理解我上面文字的意思,但如果不是,我也会提供 CSS 代码。
CSS:
#header {
display: block;
width: 590px;
height: 50px;
background: #336699;
margin: 0 auto;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
overflow: hidden;
}
.header-left-wrapper {
float: left;
width: 150px; height: 50px;
background: #ff0000;
}
.header-input-wrapper {
float: left;
width: 300px; height: 50px;
background: #00ff00;
}
.header-right-wrapper {
float: right;
width: 140px; height: 50px;
background: #ff0000;
overflow: hidden;
}
澄清一下,由于某种原因,当我申请overflow:hidden时.header-right-wrapper,整个标题向下移动,就好像我刚刚申请了marginor一样position。有什么帮助吗?提前致谢。