css alignment question

后端 未结 4 1600
一整个雨季
一整个雨季 2020-12-20 07:47

I\'m having trouble with getting unordered lists aligned how I want them to. Here\'s an image of what I\'m looking to achieve. How can I get it to look like the version on t

相关标签:
4条回答
  • 2020-12-20 08:04

    I don't know of a pure CSS technique which can handle this generically.

    I've given up and used a jQuery plugin to do this in the past for something similar:

    jQuery Masonry

    (There's also a raw JavaScript version: Vanilla Masonry)

    A picture is worth a thousand words:

    enter image description here

    0 讨论(0)
  • 2020-12-20 08:16

    float:left the ul you want in left, and float:right the ul you want at right.

    Example: http://jsfiddle.net/Xdyhy/

    0 讨论(0)
  • 2020-12-20 08:16

    Try putting the two left lists in a div and float that div left. Then float the remaining div right.

    You will have to wrap them all in one containing div otherwise the rightmost div will fly off to the edge of the page.

    0 讨论(0)
  • 2020-12-20 08:17

    use clear:both in ul

    ul { 
            float:left;
            margin: 0 20px 20px 0;
            padding: 0;
            width: 200px; 
            clear:both;
        }
    

    see here

    0 讨论(0)
提交回复
热议问题