【发布时间】:2013-04-06 21:30:49
【问题描述】:
我正在试验 css 的 float 属性。
我已经尝试编写代码匹配两个浮动 div 的高度。
两个代码
方法一。
<div style="overflow: hidden;">
<div style="background: blue;float: left;width: 65%;padding-bottom: 500px;
margin-bottom: -500px;border:1px solid White;">column a<br />column a</div>
<div style="background: red;float: right;width: 35%;
padding-bottom: 500px;margin-bottom: -500px;border:1px solid White;">column b</div>
</div>
方法二。
<div style="background-color: yellow;">
<div style="float: left;width: 65%; border:1px solid White;">column a</div>
<div style="float: right;width: 35%;border:1px solid White;">column b</div>
<div style="clear: both;"></div>
</div>
这两个代码都可以,但我想跨列创建边框。我应用了边框属性,但它不起作用。上面的代码是否有解决方案来添加边框并与所有浏览器兼容。
编辑的代码
方法3。
<div style="background-color: yellow;">
<div style="float: left;width: 65%; border-right:1px solid White;">
column acolumn acolumn acolumn acolumn acolumn acolumn acolumn
acolumn acolumn acolumn acolumn acolumn acolumn acolumn acolumn acolumn
acolumn acolumn acolumn acolumn acolumn acolumn acolumn acolumn acolumn
</div>
<div style="float: right;width: 35%;border-right:1px solid White;">column b</div>
<div style="clear: both;"></div>
</div>
具有 b 列的 div 未显示全长边框
在 方法 1 中我无法应用边框。 谁能解决这两个问题。
【问题讨论】:
-
你在哪里应用了边框,你想要它在哪里?
-
问题没有正确提出,重新整理并使其更清晰。