Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
HTML/CSS-如何制作div';让我们互相适应_Html_Css - Fatal编程技术网

HTML/CSS-如何制作div';让我们互相适应

HTML/CSS-如何制作div';让我们互相适应,html,css,Html,Css,我在试着让我的div像pinterest.com上那样互相适合。现在我的html/css是这样的: <div id="content"> <div class="box">my content, which can be xx px heigh.</div> <div class="box">my content, which can be xx px heigh.</div> <div class="bo

我在试着让我的div像pinterest.com上那样互相适合。现在我的html/css是这样的:

<div id="content">
    <div class="box">my content, which can be xx px heigh.</div>
    <div class="box">my content, which can be xx px heigh.</div>
    <div class="box">my content, which can be xx px heigh.</div>
</div>

#content{ float:left;width:1000px; }
.box{
  margin: 10px;
  padding: 5px;
  width: 220px;
  float: left;
}

我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
#内容{浮点:左;宽度:1000px;}
.盒子{
利润率:10px;
填充物:5px;
宽度:220px;
浮动:左;
}

.box可以是柱的任何高度。所以我想让我的div适合任何高度。就像pinterest.com:-)

Nevermind一样,我使用jQuery找到了这个插件:


没关系,我使用jQuery找到了这个插件:


从列的角度思考

css


.container{display:block;width:100%;/*或您正在使用的任何内容*/}
.col{显示:块;浮点:左;宽度:25%;}
.box{显示:块;填充:10px;边距:10px;}
.clear{显示:块;清除:两者;行高:0;}
加价

<div class="container">

 <div class="col">

  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>

 </div>

 <div class="col">

  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>

 </div>

 <div class="col">

  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>

 </div>

 <div class="col">

  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>

 </div>

 <div class="clear"></div>

</div>

我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。

从列的角度思考

css


.container{display:block;width:100%;/*或您正在使用的任何内容*/}
.col{显示:块;浮点:左;宽度:25%;}
.box{显示:块;填充:10px;边距:10px;}
.clear{显示:块;清除:两者;行高:0;}
加价

<div class="container">

 <div class="col">

  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>

 </div>

 <div class="col">

  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>

 </div>

 <div class="col">

  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>

 </div>

 <div class="col">

  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>
  <div class="box">my content, which can be xx px heigh.</div>

 </div>

 <div class="clear"></div>

</div>

我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。
我的内容,可以是xx px高。