Innovative way for styling numbers in ordered list

Usually, to output a numbered list , we use ol. In this case by default , we dont have any semantic way to customize the look of the numbers.

Roger Johansson provided an excellent solution for this problem. A demo page is also provided.

  • Default numbering is disabled (list-style:none)
  • Numbers are initiated using counter-reset:li property,
  • The list counter is put as a the content using :before pseudo-element
  • The counter is incremented by 1 using counter-increment:1
Note: IE7 does not support content property. People having IE8 or greater will enjoy the stylish look, otherwise default numbering style is displayed.
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s