我在让几个div用作两列时遇到问题。在下面的代码中,我希望container(或content)和right充当两列。


两者都需要边框(非图像),其中两者之间的边框的视觉宽度应与外部边框相同。
两列的topbottom之间必须具有相同的高度
right应该是固定大小


在不更改HTML的情况下,这是否有可能?

使用以下HTML:

<body>
  <div id="top"></div>

  <div id="container">
    <div id="content">
    </div>
  </div>

  <div id="right">
  </div>

  <div id="bottom"></div>
</body>

最佳答案

这将做您想要的。

标记

<body>
    <div id="top">top</div>
    <div id="container">
        <div id="content">
            content
         </div>
         <div id="right">
            right
         </div>
         <br style="clear:both" />
    </div>
    <div id="bottom">bottom</div>
</body>


的CSS

#container {border:1px solid blue;}
#content, #right {float:left;}
#content {width:400px; border-right:1px solid blue;}

10-05 20:44
查看更多