List Icons with CSS

Fancy Unordered Lists (bullet points) using CSS

Have you ever wanted to add fancy bullet points to your unordered lists in your(x)HTML but never knew how? The truth is, it’s actually really easy to achieve. All you need to do is add a CSS class to your unordered list and then use your CSS to add your chosen image as the bullet points. In this post I’ll walk you through this step by step. First lets take a quick look at the list we’re going to be creating:

  • This is the first list item
  • This is the second list item
  • and this is the third list item

Step 1: Create your unordered list, ensuring you use a classname for the ul.

OK the first step is to create your unordered list as normal, and to specify a classname on the ul element. In this example i am using a class name of “tick-list” as I’ll be using a tick image for my bullet point. The HTML code should look something like this:-

<ul class="list-tick">
  <li>This is the first list item</li>
  <li>This is the second list item</li>
  <li>and this is the third list item</li>
</ul>

Step 2: Add the CSS to specify your image to be used as a bullet point

With our HTML list in place we now need to use our CSS to control how it will look. The following CSS will remove the default margin and padding for both the ul and li elements, remove the standard unordered list bullet points, indent the list items using some padding on the left, and finally place your chosen image as a background in the padded are at the left of the list item. Your CSS for this particular list should look something like this:-

ul.list-tick {
  margin: 0;
  padding: 0;
}
ul.list-tick li {
  margin: 0;
  padding: 2px 0 2px 16px;
  list-style: none;
  background: url('../images/list_icons/tick1.jpg') no-repeat 0 50%;
}

Step 3: Dont forget to add your bullet/tick image to your server where your CSS can find it.

Of course the above HTML and CSS will not work without the image you want to use actually being available, so make sure you have them available on your server where your CSS can find them – you’ll also want to make sure that your image(s) are scaled down appropriately prior to using them, I have scaled down my bullet images to 12px x 12px so they should fit nicely beside standard sized text.

Step 4: View your fancy new list

OK, with the first 3 steps now completed, you should be ready to view you fancy new unordered list with customized bullet points, like so:

  • This is the first list item
  • This is the second list item
  • and this is the third list item

Step 5: Experiment with different images

You can add as many different customised list classes and images as you like to your website. Below are a few more examples:-
List with a ‘list-pin1′ CSS class

  • This is the first list item
  • This is the second list item
  • and this is the third list item

Another list with a ‘list-pin2′ CSS class

  • This is the first list item
  • This is the second list item
  • and this is the third list item

List with a ‘list-cross’ CSS class

  • This is the first list item
  • This is the second list item
  • and this is the third list item

List with a ‘list-note’ CSS class

  • This is the first list item
  • This is the second list item
  • and this is the third list item

List with a ‘list-mark’ CSS class

  • This is the first list item
  • This is the second list item
  • and this is the third list item

So, use your imagination, you can add bigger images if you’d like, you’ll probabally need uo use bigger li text though or more padding. Let me know if you come up with any stunning lists of your own.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>