Often I'll see a design with the list copy font the same color, typeface, and size as the normal body font. The design will highlight the items of this list by colorizing the bullet of each list-item. Using some creative HTML and CSS, this is possible with only a few lines of CSS.

  • List Item 1
  • List Item 2
  • List Item 3
  • List Item 4
HTML:
  1.    <li><span>List Item 1</span></li>
  2.    <li><span>List Item 2</span></li>
  3.    <li><span>List Item 3</span></li>
  4.    <li><span>List Item 4</span></li>
  5. </ul>

CSS:
  1. li{
  2.    color: red;
  3. }
  4. li span{
  5.    color: black;
  6. }

The bullet follows the color of the list item (li), but unfortunately so does the text contained by the li. We get around this by wrapping the text in spans and setting the font color on the span. We get our desired effect without using a list-style-image and with minimal HTML markup additions.

If you find a better way, do share for the betterment of code.

Popularity: 6% [?]

Share and Enjoy:
  • del.icio.us
  • Digg
  • Reddit
  • TwitThis
  • Google Bookmarks
  • StumbleUpon
  • Facebook
  • E-mail this story to a friend!
  • Print this article!