div之间的动态空间

时间:2012-10-09 00:31:18

标签: html css css3

所以我得到一个Div,它的宽度设置为100%宽度,这意味着它可以是每个尺寸。怎么这个div的值“min-width:950px”所以它的宽度不能低于950.

在div里面我有2行,每行包含4个div - 具有宽度的特定值

现在发生的事情是,当低分辨率的人进入我的网站时,他可以看到4个div合在一起就好了:

enter image description here

但是当有分辨率的人进入我的网站时,就像这样:

enter image description here

我想要做的是当有高分辨率的人进入我的网站时,4个div会相互占用相同的空间,所以它看起来就是这样:

enter image description here

我该怎么做?提前谢谢!

1 个答案:

答案 0 :(得分:0)

CSS样式

#container {
  text-align: justify;
  min-width: 950px;
  border: solid 1px Black; // Change this
}

#container div {
  width: 100px; //Change this
  display: inline-block;
  background: red; // Change this
}

#container:after {
  width: 100%;
  display: inline-block;
}

HTML元素

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

Codepen(Sandbox):http://codepen.io/anon/pen/HdtiC

原始文章:http://css-tricks.com/equidistant-objects-with-css/