【问题标题】:Height of left and right sides are uneven - CSS左右两边的高度不均匀 - CSS
【发布时间】:2015-06-14 10:08:45
【问题描述】:

使用以下代码,我试图让 leftsiderightside 具有相同的高度,尽管我在左侧有很多信息并且右边一点。我希望在右侧的文本下方有空位。我编码错误还是遗漏了什么?谢谢。

#sides {
  padding-bottom: 40px;
  margin-bottom; 40px;
  background-color: white;
}

#leftside {
  width: 62%;
  display: inline-table;
  background-color: #000000;
  float: left;
  padding-right: 20px;
  padding-left: 5%;
  box-sizing: border-box;
}

#rightside {
  width: 38%;
  display: flex;
  background-color: #808080;
  float: left;
  padding-left: 20px;
  box-sizing: border-box;
  flex-direction: column;
}  

<div id="sides">
  <div id="leftside">
    <h1>TONS O' TEXT</h1>
  </div>
  <div id="rightside">
    <h1>TINY AMOUNT OF TEXT</h1>
  </div>
</div>

【问题讨论】:

  • 浮动块级元素display 的计算值为block。因此display: inline-table;display: flex; 在这种情况下无效。

标签: css height


【解决方案1】:

#leftside 中删除display: inline-table;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-21
    • 2023-04-06
    • 1970-01-01
    • 2012-07-20
    • 2011-01-17
    • 2015-07-03
    • 2011-07-04
    • 2012-08-04
    相关资源
    最近更新 更多