Bulleted Lists: Multi-Layered Fudge

by Nandini Doreswamy

81 Reader Comments

Back to the Article
  1. Thanks for that, Rikkert. I read your article on classes with interest and gleaned some information about semantics from the W3C page you’ve linked it to.

    Just one suggestion – you may want to validate the CSS on your site (default.css at www.rikkertkopes.com) and the HTML markup for your article at http://www.rikkertkoppes.com/thoughts/class-and-style , as there are several errors coming up in both, in W3C’s validator.

    Thanks again.

    Copy & paste the code below to embed this comment.
  2. [offtopic:] The fun at of reading ALA is vanishing rapidly if the first four pages of comments contain nothing but slashing authots, complaining about ALA article standards etc.

    If you like to play the part of the two old men at the balcony in The Muppet Show, shouting ‘boo’ at every act, that’s fine. The problem is that you are not half as funny and you make the audience leave the theatre in the end. Please, open up your own theatre if you are so shocked by the low quality of ALA[/offtopic]

    I’m interested in the javascript versus two UL-list solutions:
    – [removed]
    When CSS is turned off you still have a split list, which I guess is fine since it will flow with the text. But what if the screen is really small and a CSS float would force the ul’s the be stacked upon each other, which is the behaviour you want, what will happen to the split list?.
    When javascript is turned off, the result would be one long list, which is not what you intend, but would still be readable and workable within the layout.
    CSS: When CSS is turned off the ul’s would be stacked up vertically in the right order. I guess this is requested behaviour and would leave the flow of text intact.

    Are there any other considerations? And what would the unobstrusive javascript solution look like?

    @arnoud berendsen: your example shows one list in Firefox 1.0, not a split list.

    Copy & paste the code below to embed this comment.
  3. My complaint about the semantics of your solution would be that you use two lists while it is actually one.
    The point of semantics is that the document itself represents the structure of the data and should not contain anything that implies something visual. In other words it should group data but not specify what it should look like. So it should not say wether text should be big or bold, or in our case tell if the list should be displayed in two columns. If you would look at the document without CSS there would be two lists while it essentially is one.

    If I say that the document can’t specify wether text should be big or not, I mean that in a entirely presentional way. It should specify that the text is a header for example, which would in most browser display in a bigger font. Same goes for italics or bold, if you emphasize text it will be displayed in italics in most browsers, strong emphasis is often displayed as bold text.

    The problem with your classnames is that you specify ‘left’ and ‘right’, which basicly controls the visual aspect instead of structural.

    @ Martijn:

    I don’t agree that arguing over the quality of the articles is useless or offensive.
    This article needs improvement and that should be said. We all learn from this discussion and excellent alternatives have been proposed.
    What does bother me is the continuous repeating of “let’s do it with a floated li with a width of 50%”

    So to get back on the main issue here, I’ve done this in the past by floating li’s with a width of 50% – oi I’m contradicting myself in the above paragraph.
    For unordered lists this is in my opinion the best solution since order is not important. After a quick thought I believe for ordererd lists a unobtrusive Javascript would do the trick because we preserve semantics. if I have time I will test this and post the results and a script.
    I do have to reconsider if it’s a good idea to split ordered lists anyway.

    To conclude I would like to thank the author for posting this since a useful discussion has been initiated. As a sidenote I think ALA should’ve used their new icon to emphasize on the non-pure semantics.

    Copy & paste the code below to embed this comment.
  4. I posted a similar article to this on my site asking how to arrange a split list. My problem was using two horizontal table cells and one list split between them. You may be interested to read the various solutions readers came up with in the comments:

    http://www.designdetector.com/archives/04/02/AQuestionOfHTMLPart2-SplitLists.php

    Regarding the article here, I would initially have considered a table. Since the list isn’t a numbered one, the order is irrelevant. So just put each list in a separate cell. This will also work when CSS is turned off.Otherwise the layout is broken, using the solutions posted here, as the list becomes a single column without CSS.

    I would not consider using JavaScript here, as the user may well have it turned off. (Again the layout will be broken and a single list will appear.)

    Copy & paste the code below to embed this comment.
  5. I don’t want to sound offending or arrogant, but I think you got it all wrong; the layout should be broken without CSS because HTML isn’t supposed to show layout in the first place.

    Using tables is even worse, like said before these list-items are not tabular data. It’s just a list of items, where a table is not. Consider the unstyled document, it should display a list (who cares if it’s split up in two rows, it’s still a list) and not a table, where the user would except some sort of relation between the items (a table should always have a header explaining the meaning of the data, which we do not need here).

    Copy & paste the code below to embed this comment.
  6. is: users (also applications – like a search engine) with CSS turned off usually say: “give me the data and not the design”, so be nice to them and give them what they ask, don’t go and split up lists in two if it’s actually one.

    Copy & paste the code below to embed this comment.
  7. @Arikawa:

    Another way to reset the default stylesheets is to define a default for all elements. W3C has a basic version of this for HTML 4 at http://www.w3.org/TR/CSS21/sample.html
    It may be a bit weighty, and there are some you’ll have to fix to be cross-browser compliant (abbr, acronym, br and remove the BDO section) but it gives you the most control.

    Copy & paste the code below to embed this comment.
  8. The design by Nandini seems to be fine to me. Just because there are multiple ways of designing doesn’t make one wrong or right as long as it conforms to web standards.
    The page was designed as an unordered list for 4 items- not numbered. Seems many posters are more interested in posting their “grand way of designing”.
    The amount of harsh attention this article has received is unnecessary.

    Can you do it differently? Sure, but isn’t that the beauty of design?

    Does it work in multiple browsers? YES.

    Does it meet what the client’s needs? YES.

    Does it slow the page load down to a point where users will leave? NO.

    You all are getting lost in the dot-and-tittle over a few bytes- you’ve wasted more space and energy than is necessary (I am speaking to the negative posters, not the ones who have kindly offered other possible solutions). To the positive posters: thank you for your continuing development of the CSS/Web standards community.

    To the negative space-wasters: Stop posting just to hear yourself talk. Learn what you can from the article and move on.

    Thank you Nandini for posting an interesting solution approach to this design. Good luck with your endevours and keep posting.

    ALA: keep posting these articles because I can learn something new from everyone.

    Copy & paste the code below to embed this comment.
  9. First off, I suppose I should take a position on the best solution so far; mine is: http://www.unbf.ca/altiustu/upload/multilayer/ If you are going to split a single list in 2 and label one “left” and one “right,” the lesser evil is certainly to preserve a single list and label individual LIs as “left” or “right”, no?

    But the larger question, in the larger context of ALA, is the way a solution is presented. I think that we can see from teh responses thus far that to be presented a solution such as teh article proposes as somehow DEFINITIVE or as a BEST PRACTICE defintiely puts the reader’s teeth on edge, preparing each to respond aggressively to faults. I mean, the article’s technique is no “Sliding Doors,” as I am sure most will ackowledge.

    I, for one, would be much more interested in articles such as these being presented as a conversation starter, encouraging the ALA community to propose their own solutions (as many have done here). If the author were to ackowledge at the beginning that s/he recognizes the drawbacks to splitting a list between ULs and requiring presentational class names, and that this solution proposed here is nothing more than one attempt at a solution, I think the community would respond more positively, and with no fewer great proposals of their own.

    Copy & paste the code below to embed this comment.
  10. Friends,

    Disagreement about techniques and passionate discussion about alternatives are healthy and productive. Hyperbole and personal attacks are not. The perpetrators of the latter seem inclined to hit-and-run tactics, and probably won’t read this. So instead of spending a lot of time on them, I want to thank you, our regular readers and contributors, for helping keep the forums professional, civil, and focused.

    You’re the reason our authors spend unpaid hours developing and writing and testing for ALA articles, and why it’s worth it for our also-unpaid staff to keep making the magazine go.

    Based on the number of proposed alternatives to Nandini’s technique we’ve seen posted so far, it’s clear that there isn’t a consensus on the One True Way to solve this design problem. Happily, the article and forum will provide a great resource for people who need it.

    Finally, one word to the less-helpful participants. The inevitable comments about ALA’s decline don’t make much of an impact on the magazine’s staff, but they do tend to derail the conversation and take focus from the article / techniques under discussion. If you feel strongly about it, please contact the crew directly or take it to your own site. If you’re just letting off steam in public for kicks, you’re wasting everyone’s time.

    Copy & paste the code below to embed this comment.
  11. Josh, you posted while I was writing the above. You might want to read http://www.alistapart.com/articles/wayitssupposedtowork/ , which we published only a few weeks ago.

    In Nandini’s article, as in most ALA articles, an author is explaining his or her own solution to a problem. No one’s presenting it as definitive or sacred, and certainly not as infallible—and if we didn’t want collaboration and discussion, we’d close the forums.

    Copy & paste the code below to embed this comment.
  12. Holly bergevin and I did a piece on this idea some time ago:

    http://www.communitymx.com/content/article.cfm?cid=27F87

    ..but we did not originate the idea, we lifted it from Paul Novitski:

    http://novitskisoftware.com/test/multiplecolumnsEms.html

    ..and also Alex Robinsion:

    http://www.fu2k.org/alex/css/cssjunk/ListColumns.mhtml

    In fact another author independently wrote about it elsewhere, the same week we did.

    Personally, I like the idea, but the small height variances from col to col kinda ruin it for me. Oh well.

    Copy & paste the code below to embed this comment.
  13. Mr Malarkey did something similar, certainly worth a look.

    Copy & paste the code below to embed this comment.
  14. waitaminute—

    the author QUIT surgeory to become a systems engineer?!  (as if new zealand wasn’t small enough…)

    Copy & paste the code below to embed this comment.
  15. I’ve got a solution (untested) for making the list run vertically and split, without splitting the element:

    td {
    width: 50%;
    position: absolute;
    /* set margins, list styles, etc. */
    }
    td+td+td { /* two items in first column */
    margin-left: 50%;
    }

    Two main problems: the code needs to be modified for different sized lists, and it uses adjacent selectors, which IE doesn’t support (though I think IE7.js could fix that).  The second column also needs to be longer than the first to avoid the following paragraph from overlapping the absolutely positioned left half.  Though margins could be used to work around this problem.

    Copy & paste the code below to embed this comment.
  16. One very very easy way to ensure that you’re properly marking up your content semantically is to completely ignore presentation (layout, styles, etc.) until you’re finished writing the content. 

    Mark up the content properly, assign ids to each division, and you can style it with CSS later.

    This avoids problems with splitting a single list in two, adding presentational classes like “left” and “right” (What if you styled them to put the left class items on the right and vice versa?  How does the markup make sense then?), and enables you or someone else to alter the layout simply by changing the style sheet – for a redesign you should not need to touch the content code.

    There’s no need to break up the lists in two here.  If you’re already resigned to altering the content markup then what’s wrong with floating the list items and reordering the list manually (or via javascript)?  Isn’t that faster, easier, and cheaper (not to mention semantically more correct) than the proposed solution in this article?

    Copy & paste the code below to embed this comment.
  17. A request to all authors of articles to be published here is to make your articles much better exemplars to those out there learning from them:

    Don’t use px sizing!!!

    Please. No really, it’s bad.

    For poor schmucks like me who actually have a nice, high-res monitor, I can only see about 6 or 7 words across in the 597px defined as being the width of the ALA main column.

    Similarly, the examples in this article hard code the list items to 400px wide in a 800px wide box… with 15px padding.

    Surely, we’ve all learnt to use percentages and the occasional ‘em’ or ‘ex’ by now? This is about basic usability, not fancy formatting.

    Copy & paste the code below to embed this comment.
  18. First, I’m not frank.
    Second, many of the “what if the client wants it this way” or “that way” statements don’t apply to this article. Why? Because it appears the author’s client wanted <ul>s, not <ol>s. As a developer we have to use judgement and treat each design differently when we’re laying it out. This is one way of doing it, although I would have simply used • and discarded the use of the <ul> and its <li>‘s entirely- yet its nice to know that there is more than one way to utilize <ul>.
    Third, I love this site. Keep it up.

    Copy & paste the code below to embed this comment.
  19. I have one question which is not directly related to this article, but to the site you mentioned at the end of your article (and I’m asking because I suppose that you’ve designed it). The question is:

    On the top of this site you can see some links: “home”, “products”, … Next to each link there is a small icon. These icons are not part of the html, they are defined in the CSS and they are displayed as background images. This causes one serious problem: If you print the site, these icons do not appear!

    I wonder if there is a solution to this problem (of course I can tell my browser to print background images, but I want a way the designer can influence the printing behaviour with CSS).

    The same problem occurs to many style sheets shown in the CSS Zen Gaarden: Most style sheets replace some headlines with graphics. These graphics would never be printable because they are background graphics.

    If anyone has a solution to this problem, I’d love to read it in a new article for ALA.

    Copy & paste the code below to embed this comment.
  20. The solution for getting columns of list items really is simpler than all of you are making it out to be.  Moreover, you can do “in order” if you wanted.

    In fact, this is a fairly common request, so common that it lead to a faux-column example:
    http://cssirc.com/codes/?code=30#ordered-columns

    The solution is fairly simple: #ordered ol, #ordered li { margin: 0; padding: 0; display: block;
    } #ordered ol { position: relative;
    }
    /* creates the “first column” */ #ordered li { float: left; clear: left; width: 50%;
    }
    /* creates the “second column” */ #ordered li.col2 { /* basically UNDO everything set above */ float: none; clear: none; width: auto;
    }

    Copy & paste the code below to embed this comment.
  21. First, there’s no requirement of balance.  That is, you can have arbitrary numbers of “elements” in each column.

    Second, since this is for demonstration purposes only, and since IE doesn’t understand complex selectors, it uses simple class names to set off the alternate column.  It would probably be more helpful to distinguish them more descriptively.

    Lastly, IE screws up the numbering of ordered lists (1, 2, 3…) once you’ve removed a particular list item from the document flow (either by floating or absolute positioning). So you can’t rely on that.

    Copy & paste the code below to embed this comment.
  22. Suppose I want to create two ordered lists, side by side, about President Bush.

    The first list is titled “The Good” and contains 2 items. The second list is titled “The Bad” and contains 44 items.

    You are not going to be able to do this, in order, with your single list solutions.

    Just because Nandini used an UL instead of an OL does not mean that some people are not interested in the 2 list solution.

    I have been looking for a way to do this on my own web site for a while now. I had it working perfectly with absolute positioning…until my brother increased the font size on his computer and my text went flying out of the absolutely positioned div.

    Using relative positioning and flow trickery allows people to use larger text while viewing my site and it still looks like I intended it to.

    Thanks to Nandini and others who posted acceptable solutions to this issue. Thanks to those who posted solutions to the wrong issue (the “this is one list” issue). Some of those posts were very informative, as I use both OL’s and UL’s split into columns.

    Copy & paste the code below to embed this comment.
  23. Kody –
    Your example of “The Good” and “The Bad” might still be considered a single list with two different headings.  This is understood as “a list of Bush’s traits.”  The more I think about it, the more I disagree that they are two distinct lists.

    You can achieve a list with multiple headings fairly simply using a dl/dt/dd (which per the specs is not limited solely to definitions).

    Nevertheless, the problem described in the main article is definitely a single list problem.  As the example illustrates by saying things like “item 1” through “item 4”.  It would be different, perhaps, if the problem was “item 1.1” through “item 2.2”, for example.

    Finally, multiple list solutions are nothing new.  People have floated elements into “columns” for a very long time.  Float the first “column” and give a margin left to the second one.  There’s nothing special about lists, really. The only “issue” then is a containing floats problem which has very well documented solutions.

    Copy & paste the code below to embed this comment.
  24. Nandini, I looked at the linked site—it looks really good, but I thought you’d like to know that on the “about us” page, the text in the second paragraph goes past the center background box and spills out over the outer background. I’m using Safari 1.2.4 on OSX. Hope this helps!

    Copy & paste the code below to embed this comment.
  25. Thanks for your valuable feedback, Crystal. I’ll try my best to sort out the mystery of the paragraph spill.

    Copy & paste the code below to embed this comment.
  26. Did you know that Netscape 7.1 doesn´t render your page very well? The lists are missing!

    www.radiusnetworks.co.nz/computer-services.htm

    Copy & paste the code below to embed this comment.
  27. This solution is really great for a fixed number of bullets. What if your data is pulled in dynamically and you want the items to run in a columnar fashion? For example: a list of birthdays for a particular month that are ordered by day, top-to-bottom.  How could these lists get rendered semi-evenly across 3 columns (or so) using CSS?

    Copy & paste the code below to embed this comment.
  28. FWIW, I did a write-up on this about a year ago.  Please see:

    http://wickedways.org/articles/floatinglists/

    Copy & paste the code below to embed this comment.
  29. Not sure how this got published. 1. This would be cool if the it was all in one list with no special classes for left/right 2. Paragraph spacing issue should be fixed by just setting the default padding/margins for paragraphs. 3. More reasons…
    I expect more.

    Copy & paste the code below to embed this comment.
  30. i’ll be sure to use this in the future. this beats the implementation the make-shift solution i did for my portfolio site’s 2-column list.

    Copy & paste the code below to embed this comment.
  31. My apologies to the author, but this has got to be one of the least informative articles ever to grace the front of alistapart.  I know they’re hurting for content, but… geesh.

    anyhow, i took 5 minutes to take the authors approach and create a clean, completely unclassed page that accomplishes everything the author intended.  I eliminated floating the <ul>‘s left and right, and am floating them both to the left.  I assigned clear:both to the tags to prevent them from creeping upward at all.  I used PIE’s float-clearing trick to make sure my div wrapped the entire setup.

    It’s as close to 100% semantic as we can get with CSS2.

    http://www.reaxion.org/listapart.html

    Copy & paste the code below to embed this comment.