CSS3 Multiple Columns

css3 multiple columns

Use CSS3 to create a set of columns on your website without having to assign individual layers and / or paragraphs for each column.

Along with multiple background images, this following piece of CSS3 is among my favourites list. I think there is a lot of great potential for this CSS and in ways more than just a news paper/magazine layouts too!

CSS 3 Multiple Columns (Width)

One early risen morning, grass layden with dew, Alex awoke with a vision, he knew through and through. It was dark, it was steamy with a heart warming glow. The kettle went on and it’s coffee for all! Okay, so it is maybe not a master piece of a tale but I wanted something here that was not Lorem Ipsum! I think it worked. Coffee anyone?

The above paragraph is set to create 2 columns using the following css3 code

  1. CSS 3 Multiple Columns (Width)
  2. #my_CSS3_id {
  3. text-align: justify;
  4. -moz-column-width: 15em;
  5. -moz-column-gap: 2em;
  6. -webkit-column-width: 15em;
  7. -webkit-column-gap: 2em;
  8. }

An example for those on alternative browsers not seeing multiple columns above..

CSS 3 Multiple Columns (Count)

One early risen morning, grass layden with dew, Alex awoke with a vision, he knew through and through. It was dark, it was steamy with a heart warming glow. The kettle went on and it’s coffee for all! Okay, so it is maybe not a master piece of a tale but I wanted something here that was not Lorem Ipsum! I think it worked. Coffee anyone?

The above paragraph is set to create three columns using the following css3 code

  1. CSS 3 Multiple Columns (Count)
  2. #my_CSS3_id {
  3. text-align: justify;
  4. -moz-column-count: 3;
  5. -moz-column-gap: 1.5em;
  6. -moz-column-rule: 1px solid #c4c8cc;
  7. -webkit-column-count: 3;
  8. -webkit-column-gap: 1.5em;
  9. -webkit-column-rule: 1px solid #c4c8cc;
  10. }

An example for those on alternative browsers not seeing multiple columns above..

The Zen Elements CSS3 Series

Thank you for reading!
@zenelements // Alex

Like this article?

Subscribe to our rss, follow our tweets or please help us spread the work & share this with your friends!

Thank you for all your support; have a cookie!

24 Comments on “CSS3 Multiple Columns”

  1. Matt 22.01.2009 at 1:58 am

    ‘Cross Brower Compatability’
    ‘… means we will concentraite’

    Just some spelling mistakes I picked up on, :).

    Good article! I look forward to CSS3 becoming more mainstream, hopefully soon!

  2. Zen Elements 22.01.2009 at 3:57 pm

    @Matt:
    Nope. No such errors. Don’t know what you’re talking about.. *admits shyly* spelling was not a strong point in there.

    Thanks for highlighting ;)

  3. santiago 14.04.2009 at 2:15 pm

    this i fu$@!$# great =)
    one question… what’s this for? -> column-rule: 1px solid #dedede;?
    cheers

  4. Zen Elements 15.04.2009 at 9:29 am

    @Santiage | Thank you, I’m glad you enjoyed this and I’m certainly looking forward to when it is greater support cross-browser.

    The code you mentioned – column-rule: 1px solid #dedede; – is to create a verticle border line between the columns. This I have found currently only to work well in Safari.

  5. Nico 23.05.2009 at 9:54 am

    That’s great. I hate use php parsers to get nice looking columns like I would get with this simple code. But there is no other way with ~15% IE6 Users…

  6. Ben 24.05.2009 at 4:56 pm

    Great little bit of tutoring there!

    You might want to change the column width in the “by width” example to something smaller, like 10em. I don’t know what CSS reset (if any) you’re using, but on my Dell 2408 with FF3 the column width is wide enough for the text, and there’s only one column generated. Playing with Firebug, 15em makes two, while 10em makes three. :)

    Just FYI…

  7. Zen Elements 24.05.2009 at 5:12 pm

    @Ben | Thank you! The error will have snuck in after I did a little redesign of the blog a while back where I reduced the display width, thereby creating this slight hickup. Glad you enjoyed the tutorials and thank you for the heads up on that! Alex.

  8. Gorenov.com 15.06.2009 at 7:40 pm

    # Internet Explorer (IE6, IE7, IE8…)
    # Opera (9.6)

    I hope it will support soon.

  9. HamdenDesigns 02.07.2009 at 6:33 pm

    using it! love it!!

  10. Helen 20.07.2009 at 2:49 pm

    It’s a pity that sites with much text and information, that could take advantage of this technique, are visited during office hours with unable browsers. Unfortunately it is difficult to get a fallback.

  11. Josh 29.11.2009 at 7:33 pm

    I love this. I can already see so many uses for between the multiple sites that I manage. It’ll be nice when CSS3 is ratified and we can stop with the browser extensions and go with the real CSS3 properties.

  12. Rikard Isacsson 13.04.2010 at 2:29 pm

    Love it. I tried forever with tables to create columns.. It never looked quite right.

    I’m looking forward to CSS3 becoming the standard and Internet Explorer gets taken out together with the rest of the trash.

  13. armanaexpert 18.04.2010 at 8:37 am

    sip. very nice and usefull for me. thanks

  14. stephen 04.05.2010 at 3:33 pm

    Great information. I must try this.

  15. Ben Peck 15.07.2010 at 7:56 pm

    Very nice. I really don’t know why it takes so long for browser to play nice with each other. Really, can’t they just create a board and make decisions together about compatibility issues.

  16. warawat 13.10.2010 at 7:01 am

    using it! love it !

  17. Carlos 28.02.2011 at 2:59 pm

    Great! I will be used this information for update my website, thanks

  18. Reclamebureau Nijverdal 07.04.2011 at 3:14 pm

    This is really great way of working with functions that will work for clients that don’t think about alignment.

  19. Tribby 25.06.2011 at 8:43 pm

    Interesting read — I can’t believe this was first proposed so many years ago without implementation.

  20. Arvind Bhardwaj 04.07.2011 at 7:20 am

    Hi,
    Really nice article.
    Thanks for the useful information.

  21. pranav 09.08.2011 at 6:58 am

    Very nice tutorial, very helpful for new users of CSS

  22. David 12.09.2011 at 2:07 pm

    Very nice – using it on my site. Thank you!

  23. Tre 21.10.2011 at 9:03 am

    Nice to know and it will definitely reduce the overall coding. Now hope all browsers will understand it.

  24. Bill 03.01.2012 at 12:20 pm

    Great work!!!

    Thanks for making the code easy to find by writing it inline. You saved us some searching.

 

Leave a Reply

(required; who are you?)

(required; we'll keep it safe!)

(optional; promote your site!)