【问题标题】:Splitting a div in three vertical parts将 div 分成三个垂直部分
【发布时间】:2023-04-06 02:13:02
【问题描述】:

我想将 html 中的 div 一分为三。 我的代码如下:

<div id="right" style="width: 20%; float: left;">
    some text
</div>
<div id="leftAndCenter" style="width: 70%; float: right;">
     <div id="center" style="width: 45%; float: left;">
           some other text
     </div>
     <div id="right" style="width: 45%; float: right;">
           and the last text
     </div>
</div>

有一个版本更长的文本here。我希望右边的文字与“left”和“center”的高度相同,我应该怎么做?

【问题讨论】:

    标签: html css


    【解决方案1】:

    删除此行: &lt;br style="clear:both;"/&gt;

    【讨论】:

    • 确实,写js fiddle的时候忘记了。现在可以使用了,谢谢!
    【解决方案2】:

    拳头解决方案:

    删除您示例的&lt;br style="clear:both;"/&gt;

    第二种方案,更好的html:

    <div>
       <div style="width: 20%; float: left;">foo </div>
       <div style="width: 33%; float: left;">bar</div>
       <div style="width: 33%; float: left;">biz</div> </div>
    

    【讨论】:

      猜你喜欢
      • 2012-08-12
      • 1970-01-01
      • 2021-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多