CSS在单个包装器中固定+流体

时间:2013-02-07 18:13:03

标签: html css

如何让第二个div扩展到this examplefooter的全宽?

我想避免给第二个div增加宽度。第一个div的固定宽度为80px

Update :那么如何让黑狐狸的身高与浅灰色相同呢?

1 个答案:

答案 0 :(得分:3)

使用float:left代替display:inline-block并将浮动仅应用于第一个div。

jFiddle here

div {
  padding: 20px;
  background-color: #ccc;
}

div:first-child {
  width: 80px;
  background-color: #000;
  color: #fff;
  float:left;
}