HTML/CSS-如何制作div';让我们互相适应
我在试着让我的div像pinterest.com上那样互相适合。现在我的html/css是这样的: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 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高。