How can we achieve the fixed width and variable height in a grid layout, exactly like www.pinterest.com homepage layout. I think they are using Javascript. just wondering whether there are other approaches. simply using the float:left
will not work. thanks for any help.
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- jQuery hover to slide?
- Issue with star rating css
May be you can use css3
cloumn-count
property as an alternative. Like this:Read this article http://css-tricks.com/seamless-responsive-photo-grid/
Check this for example http://jsfiddle.net/pMbtk/55/
The easiest option is to use the jQuery Masonry plugin.
If you want to do it via CSS only, you have to float large, equal width columns and then add your variable height elements within them.
And the CSS would look like so: