Styling the number of an ordered list

I’m sure it’s possible, isn’t it? I’ve searched high and low and can’t seem to figure out if it can be done. Should be simple — and I’m hoping it is: Can the number that is generated by an ordered list be styled seperately from what is contained within the li tag with CSS?

For instance, I’d like to bold the number, but not what’s in the li. Giving font-weight: bold to the ol doesn’t do it. And giving font-weight: bold to the li tag just bolds the whole thing. I realize I could add a span in there, but that seems uneccesary.

Seems like a completely logical thing to do — give the number special treatment like bold or a different color or font size.

I’m waiting for someone to make me feel stupid. And hoping…

6 Comments

  1. Gena says:

    Was there ever an answer for this?

  2. Josh says:

    Well, your comment now has a bold #1 by it, Gena, so I guess he figured it out. Question is: how?

  3. Chris D says:

    Josh didn’t look at the source code… The bold #1 is simply so because it’s wrapped in a pair of strong tags. Furthermore, the comments are stored in a definition list, which is not the correct semantic use of such lists.

  4. Chris D – How can you can say a definition list is “not the correct use”? The spec is rather vague, and leaves room for interpretation. Seems a list of comments is a perfectly fine application for them.

  5. Anonymous says:

    You are right Dan, by reading my previous post I realized that it does come across as over confident… I should have used the more cautious approach of “In my humble opinion” as I strictly base my post on that. :)
    I did stumble on a SimpleQuiz from a while ago that led to this kind of debate in the comments. BTW, my answer’s C. Too late now for the t-shirt I guess, eh? :P
    I based my opinion on Tantek’s recent presentation: The Elements of Meaningful XHTML in which he touches on the subject on page 33. Mind you, I was not lucky enough to attend his presentation, so I am missing on any complementary information he might have added in spoken explanations.
    I agree with you that there is room for interpretation. However, I find that the name leaves less of it. A definition list should by definition and in my opinion, contain just that, definitions.
    Cheers,
    CD

  6. Chris D says:

    You are right Dan, by reading my previous post I realized that it does come across as over confident… I should have used the more cautious approach of “In my humble opinion” as I strictly base my post on that. :)
    I did stumble on a SimpleQuiz from a while ago that led to this kind of debate in the comments. BTW, my answer’s C. Too late now for the t-shirt I guess, eh? :P
    I based my opinion on Tantek’s recent presentation: The Elements of Meaningful XHTML in which he touches on the subject on page 33. Mind you, I was not lucky enough to attend his presentation, so I am missing on any complementary information he might have added in spoken explanations.
    I agree with you that there is room for interpretation. However, I find that the name leaves less of it. A definition list should by definition and in my opinion, contain just that, definitions.
    Cheers,
    CD