Deal-breaker problems with CSS3 multi-columns

Firefox and Webkit support some of the CSS3 multi-column layout properties—but not very well. Unfortunately, the spec isn’t very clear about what’s correct. Until the spec is clearer and the browser problems are ironed out, multi-columns are useless to me.

Share this:

  • Twitter
  • Google +1
  • Facebook

I’ve been playing around with the new multi-column properties of CSS3 (column-count, column-width, and so forth), and I’ve come to the conclusion that they’re sadly not ready to really use. Sure, use them in experimental sites, and maybe even in mainstream sites in small doses with very particular types of content. But for most content, I found that there’s not enough control over how the content is distributed between columns to make them reliable. I’m not sure if the browser behavior I’ve been seeing is correct or not; the spec is unfortunately not well defined enough to make it clear—at least to me—of how browsers ought to be handling some of the problems I ran across.

Balancing column heights

The first problem is how the browser should handle one or more extra lines of content if the amount of content cannot fill up each column equally. In my opinion, the extra content should come at the bottom of the first columns, so that columns further to the right are never longer than columns further to the left. This is pretty standard practice in print design, and having it any other way just looks really strange. At least to me. Take a look and you decide:

spacer

The last column has one extra list item and line than the previous columns.

spacer

Doesn't this look weird?

spacer

Another example of the last column being longest.

You can check out the first demo page yourself. Resize the window and see how each browser handles column number, placement, and height.

It seems like the column-fill property is supposed to address this problem, but I may be misunderstanding what it’s supposed to do. In any case, my testing has shown that no browser supports it, even with browser-specific prefixes. So, we’re left with these unbalanced, awkward looking columns.

In some cases, I understand why the browser is making later columns taller than earlier ones. For instance, there’s a bottom margin on one of paragraphs that happens to fall at the end of one of the columns, leaving a gap and making that column shorter than the following column. I know there are cases when this behavior is desirable and necessary given the content. But we ought to be able to control it, and we can’t right now, and the default browser decisions about how to fill look weird to me in many cases.

Flowing margin and padding across columns

The second problem is how the browser should handle margin and padding on elements inside the columns. Webkit will let margin and padding be split in between columns; even when it doesn’t split a bottom margin, it will often let the entire margin show up at the top of a column. This can result in some extremely ugly and bizarre stuff:

spacer

Safari and Chrome break margin and padding between columns.

Check out the second demo page with extra margin and padding added.

Firefox, on the other hand, expands the height of the column area to accommodate the padding, and let’s margin escape out the bottom (margin collapsing at work, I guess) rather than letting it show up at the top of a column.

spacer

Firefox makes the bottom margins on the last items in the columns just disappear, instead of splitting those margins across columns or allowing them to show at the top of a column.

Again, the spec doesn’t seem to say anything about which implementation is correct (does it?), but in my opinion, the way Webkit handles it just has to be wrong. Margin and padding are never ever split, are they? And even if they are split in other non-column CSS layout scenarios, it certainly doesn’t make sense to do it in columns. Again, it breaks with print design conventions; while I know web design does not have to emulate print, there are certain typographic conventions that we’ve preserved on the web for readability’s sake, and breaking them would make most people say it looked “wrong.” I think this is one of those cases, and in my opinion, it’s the biggest deal-breaker for using columns right now. Or at least, using them in Webkit-based browsers.

Again, if there are fringe cases where it makes the most sense to split the margin and/or padding, by all means let’s do it. But we need a CSS property to control that, and it doesn’t look like there is one in the spec now. So for now, I hope Webkit changes how they handle this to match up with Firefox’s more intuitive choice, and that the W3C clarifies this in the spec.

Breaking content across columns

Finally, the third problem is that neither Firefox nor Webkit seem to support the column break properties. For instance, adding break-inside: avoid-column; to the li elements should keep the content in each list item from breaking across columns. Unfortunately, it doesn’t work right now.

spacer

The text "Start sociis natoque end" is all one list item, but both Webkit and Firefox break content within the list items.

The third demo page is the same as the first one, but it has the break-inside properties added. As you can see, it behaves the same as the first demo.

Controlling breaking isn’t necessarily a big deal with a simple series of paragraphs, but it becomes more important on lists with brief list items, as shown in the image above, and when you have headings mixed in the text, as you definitely want to make sure that headings stay with their following text. Not having support for the breaking properties can really impede usability and limits the usefulness of multi-columns.

Next steps? Workarounds?

Given these problems, multi-column layout isn’t very useful to me right now. Honestly, it’s always been something that I’ve thought should be used only sparingly, in very particular cases. But with these problems, I’m not going to use it in any cases. I’m really hoping that the spec continues to evolve and that browsers continue to update their implementation of these features. (I’m mainly looking at you, Webkit.)

In the meantime, if anyone has any workarounds for these problems, I’d love to hear them!

Share this:

  • Twitter
  • Google +1
  • Facebook

Related Posts:

  • Building Responsive Layouts presentation at CSS Dev Conf
  • Some updates to stunningcss3.com, and a border-image problem
  • The Future of CSS Layout presentation at Future of Web Design conference
  • Building Responsive Layouts presentation at Responsive Web Design Summit
  • Examples of flexible layouts with CSS3 media queries

April 02, 2010

Categories: Articles

Tags: browsers, columns, CSS, CSS3, layout, W3C

60 Comments

  • Cascading Style Sheets Reference Links | kabayview.com says:
    October 10, 2011 at 10:00 am

    [...] Deal-Breaker Problems with CSS3 Multi-Columns – Zoe Gillenwater [...]

    Reply
  • Rails – how to build a grid | SeekPHP.com says:
    October 19, 2011 at 12:02 pm

    [...] I have an odd number of products then the column spills over to the next column. I read that there is a bug with this using CSS [...]

    Reply
  • spacer Clay says:
    November 22, 2011 at 9:13 am

    Wow – this explains a lot! I thought I was going nuts with the difference in column heights. Thanks Zoe. spacer

    Reply
  • 20 Useful CSS3 Tutorials and Resources | Template Monster Blog says:
    December 22, 2011 at 5:57 am

    [...] sources that might help you know more about software issues connected with CSS3 implementation.* * *CSS3 Multi-ColumnsMulti-Column layout is now avaliable thanks to CSS3 but there are still many problems with browser [...]

    Reply
  • spacer Jason Garber says:
    January 12, 2012 at 7:43 am

    You should go upvote the issue in Bugzilla: https://bugzilla.mozilla.org/page.cgi?id=voting/user.html&bug_id=549114#vote_549114

    Reply
  • spacer Damon says:
    July 2, 2012 at 11:25 am

    Good rundown of why CSS3 columns are unusable! Disappointed that as far as I can tell little has improved in the last 2.25 years…

    Reply
  • spacer Bethany says:
    July 30, 2012 at 4:12 pm

    Looks like dude found a workaround: bengillies.tiddlyspace.com/masonry.css
    I added overflow: auto; max-px; to the div that I didn’t want broken up, and it worked great

    Reply
  • 50 New Useful CSS Techniques, Tools and Tutorials « Creative Digital Media says:
    October 7, 2012 at 4:40 am

    [...] Deal-breaker problems with CSS3 multi-columns “I’ve been playing around with the new multi-column properties of CSS3 (column-count, column-width, and so forth), and I’ve come to the conclusion that they’re sadly not ready to really use. I found that there’s not enough control over how the content is distributed between columns to make them reliable. I’m not sure if the browser behavior I’ve been seeing is correct or not; the spec is unfortunately not well defined enough to make it clear—at least to me—of how browsers ought to be handling some of the problems I ran across.” [...]

    Reply
« Older Comments

Leave a Reply

Click here to cancel reply.

Required fields are marked with an asterisk (*). You may use these tags in your comment: <a class="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.