这个网站是如何形成的?事业部调整,坚持相互 [英] How is this website made? Div align and stick to each other

查看:319
本文介绍了这个网站是如何形成的?事业部调整,坚持相互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例: http://jsfiddle.net/BpYZn/

这是被我想获得: http://www.akinyapin.com/

根据浏览器大小的div从3重新调整每行5%的行(也许更多,我的屏幕为1366×768,也无法检查)。

我trye​​d刚刚作出div元素,以配合浮动属性。 它的工作原理部分,它们缩小到3每行视浏览器的大小,但他们不会粘在一起。有不同行的div之间很大的差距。

第二个网站使用了位置是:绝对的。是否有这种事情的脚本,任何人都知道可能?

这是div的CSS

  .box1 {
填充:7px的;
位置:亲属;
保证金:1px的;
背景颜色:白色;
宽度:230px;
最小高度:200像素;
浮动:左;
-webkit-边界半径:2px的;
-webkit-用户选择:无;
-moz-用户选择:无;
-khtml用户选:无;
用户选择:无;
}
 

解决方案

本网站使用了一个JavaScript插件叫做砌体这是做堆叠div的魔力。我看不出这种效果正在完成纯CSS。

EXAMPLE: http://jsfiddle.net/BpYZn/

Here is was I want to get: http://www.akinyapin.com/

Depending on the browser size the divs realign from 3 per row to 5 per row(maybe more, my screen is 1366 × 768, can't check).

I tryed just making the div elements to align with the float attribute. It works partially, they shrink to 3 per row depending on browser size but they wont "stick" to each other. There are big gaps between the divs in different rows.

The second website uses the "position:absolute". Is there a script for that kind of thing that anyone knows maybe?

This is the div's css

.box1{
padding:7px;
position:relative;
margin:1px;
background-color:white;
width:230px;
min-height:200px;
float:left;
-webkit-border-radius: 2px;
-webkit-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
user-select: none;
}

解决方案

The website uses a javascript plugin called Masonry which is doing the stacking divs magic. I don't see this effect being accomplished with pure css.

这篇关于这个网站是如何形成的?事业部调整,坚持相互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆