Tricky css / javascript浮动任务 [英] Tricky css/javascript floating task

查看:143
本文介绍了Tricky css / javascript浮动任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个设计,有几个div在不同的宽度/高度,我需要他们浮动基本上到左上角。一个简单的css float:left不会工作,因为它一旦下降到一个新的行不利用垂直空间。

I have a design that has several divs at varying widths/heights and I need them to float essentially to the top left. A simple css float:left will not work because it does not take advantage of the vertical space once it drops to a new line.

我假设我需要使用jQuery动态定位每个div,但我希望有人可以引导我在正确的方向。

I assume I will need to use jQuery to dynamically position each div but I was hoping someone could lead me in the right direction.

这是一个标准的float剩下的做:

This is what a standard float left would do:

这是我需要做的:

This is what I need it to do:

推荐答案

您的网站的内容更新时,尝试砖石插件

Have you tried the masonry plugin?

这篇关于Tricky css / javascript浮动任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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