【问题标题】:Placing three DIVs inside of a parent side by side将三个 DIV 并排放置在父级中
【发布时间】:2014-02-25 19:25:30
【问题描述】:

我正在努力弄清楚如何做到这一点。我有一个带有灰色背景(一行)的父 DIV,其中包含三个子 DIV。父 DIV 宽度为屏幕的 100%。 Child A 是一个 DIV,即一个图像,并设置整个行的高度。

子 DIV B 和 C 将行宽的剩余部分分成两半,并与行高匹配。我可以将它放到所有 DIV 的高度相同但子 DIV B 和 C 没有填满父母 DIV 的其余部分的位置。

【问题讨论】:

  • 你能创建一个jsfiddle.net吗?
  • 我会在使用 PC 后发布一个

标签: html css


【解决方案1】:

这是一个 sn-p,我了解您正在尝试做的事情。 (也在plunker。)

.left{
  float: left;
  height: 120px;
  width: 200px;
  background-color: whitesmoke;
  }
.right{
  height: 60px;
  background-color: yellow; 
}
<!DOCTYPE html>
<html>

  <head>
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
  </head>

  <body>
    <div>
      <div class="left">Div 1</div>
      <div class="right">Div 2</div>
      <div class="right">Div 3</div>
    </div>
  </body>

</html>

【讨论】:

猜你喜欢
  • 2013-03-11
  • 2016-02-17
  • 2019-01-07
  • 1970-01-01
  • 1970-01-01
  • 2013-07-09
  • 2020-01-28
相关资源
最近更新 更多