Tiling divs with irregular sizes

From C++ to PHP, debugging to webhosting; help and discussion about writing your latest program to running your website. NOT for help when your PC won't work.

Announcements Posted on
TSR launches Learn Together! - Our new subscription to help improve your learning 16-05-2013
Sign in to Reply
  1. jordan.uni's Avatar
    • Junior Member
    • Location: UK
    • Posts: 63
    Tiling divs with irregular sizes
    http://puu.sh/B59Y

    How would I go about tiling divs with irregular sizes so that they appear as above?
    Last edited by jordan.uni; 15-06-2012 at 18:01.
  2. Tycho's Avatar
    • Exalted and Worshipped Member
    • Posts: 1,222
    Re: Tiling divs with irregular sizes
    Can't see your image.
  3. jordan.uni's Avatar
    • Junior Member
    • Location: UK
    • Posts: 63
    Re: Tiling divs with irregular sizes
    How about now?
  4. Jake9's Avatar
    • Adored and Respected Member
    • Posts: 505
    Re: Tiling divs with irregular sizes
    Use
    Code:
    position: absolute;
    left: *distance from left*;
    top: *distance from top*;
    for each tile
  5. jordan.uni's Avatar
    • Junior Member
    • Location: UK
    • Posts: 63
    Re: Tiling divs with irregular sizes
    I can't do that for each tile, it's a dynamic website so when new tiles come in they will be out of place. I'm looking for an automatic way of doing it.
  6. Rob801's Avatar
    • Exalted and Worshipped Member
    • Posts: 1,158
    Re: Tiling divs with irregular sizes
    A javascript solution like http://masonry.desandro.com/ (a jQuery plugin) would be your best bet. What you're trying to do isn't possible without javascript or some sort of server side script dynamically generating the styles.
  7. estel's Avatar
    • TSR Idol
    • Location: Bristol
    • Posts: 9,352
    Re: Tiling divs with irregular sizes
    Masonry (or one of its equivalents) is your only sane choice here.
  8. cleverslacker's Avatar
    • Respected Member
    • Location: Not here
    Re: Tiling divs with irregular sizes
    (Original post by Rob801)
    A javascript solution like http://masonry.desandro.com/ (a jQuery plugin) would be your best bet. What you're trying to do isn't possible without javascript or some sort of server side script dynamically generating the styles.
    Dang, got there first.

    Adding to that, it would help if there's some regularity in your widths - they don't all have to be the same width, but preferably multiples of a reasonable number. That way, some can take up 1 column, some 2, etc. Have a look at the source here: http://masonry.desandro.com/demos/ba...ti-column.html

    I used the single-column version as part of a tumblr theme, but it looks ugly atm. Pinterest also has a similar system, only they made it themselves.

    You can just use CSS float, e.g. div{float:left}, but it leaves massive gaps.
  9. RROD's Avatar
    • New Member
    • Posts: 15
    <iframe> tags.


    This was posted from The Student Room's iPhone/iPad App
  10. estel's Avatar
    • TSR Idol
    • Location: Bristol
    • Posts: 9,352
    Re: Tiling divs with irregular sizes
    (Original post by RROD)
    <iframe> tags.


    This was posted from The Student Room's iPhone/iPad App
    I don't see that would help? Leaving aside the million issues with iframe, you're still left with the former issue of positioning them as required.
  11. jordan.uni's Avatar
    • Junior Member
    • Location: UK
    • Posts: 63
    Re: Tiling divs with irregular sizes
    (Original post by cleverslacker)
    Dang, got there first.

    Adding to that, it would help if there's some regularity in your widths - they don't all have to be the same width, but preferably multiples of a reasonable number. That way, some can take up 1 column, some 2, etc. Have a look at the source here: http://masonry.desandro.com/demos/ba...ti-column.html

    I used the single-column version as part of a tumblr theme, but it looks ugly atm. Pinterest also has a similar system, only they made it themselves.

    You can just use CSS float, e.g. div{float:left}, but it leaves massive gaps.
    Yeah, I'm trying to do this for a tumblr theme also.
  12. cleverslacker's Avatar
    • Respected Member
    • Location: Not here
    Re: Tiling divs with irregular sizes
    (Original post by jordan.uni)
    Yeah, I'm trying to do this for a tumblr theme also.
    For me, it looks like it hasn't worked - it seems to be CSS float, with gaps. Need any help?
  13. jordan.uni's Avatar
    • Junior Member
    • Location: UK
    • Posts: 63
    Re: Tiling divs with irregular sizes
    Oh, I managed to achieve what I wanted to achieve, the theme has since changed.

    Masonry worked perfectly for what I wanted, cheers guys.
  14. fran.ha's Avatar
    • TSR Demigod
    • Location: Kent
    Re: Tiling divs with irregular sizes
    Could you not contain them all within larger divs?
Sign in to Reply
Share this discussion:  
Useful resources
Article updates
Moderators

We have a brilliant team of more than 60 volunteers looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

Reputation gems:
The Reputation gems seen here indicate how well reputed the user is, red gem indicate negative reputation and green indicates a good rep.
Post rating score:
These scores show if a post has been positively or negatively rated by our members.