Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS Counter

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #35102
    AntonNiklasson
    Participant

    Hey guys, I’ve got a question for you.

    I’ve got this html table with two columns. It will contain a name, and a number.
    So now I’d like to insert line numbers in front of each name, like this:

    1. Joe Smith 12345

    I do think it’s possible with pure CSS. Chris talks about a bit in this article down at the part where he styles a “code box”. There is a way of counting number of lines with CSS.

    This is what I’m thinking:

    tr:nth-child(n) td:first-child:before { content: counter(child) “. “; }

    Any ideas?

    #90398
    Chris Coyier
    Keymaster
    #90399
    Chris Coyier
    Keymaster

    And for the record, that article was totally theoretical, it just so happens THIS works =)

    #90421
    AntonNiklasson
    Participant

    Nice :)
    Oh, okey. Realized that just now. Thanks a lot Chris!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.