Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS using images instead of bullets

Tags:

css

html-lists

I want to use three different images instead of bullets to create a lisli>t

Example:

<ul>
    <li>The dog is big</li>
    <li>The dog is small</li>
    <li>The dog is medium sized</li>
</ul>

So instead of bullets before each of the above phrases there would be a different image before each.

like image 565
SwaggrK Avatar asked Feb 23 '11 16:02

SwaggrK


2 Answers

Live Demo

This makes use of the CSS property list-style-image.

ul {
  margin: 0 0 0 32px;
  line-height: 1.5
}

.b1 {
  list-style-image: url(http://upload.wikimedia.org/wikipedia/commons/1/19/Icons-mini-icon_attachment.gif);
}

.b2 {
  list-style-image: url(http://upload.wikimedia.org/wikipedia/commons/6/61/Icons-mini-icon_security.gif);
}

.b3 {
  list-style-image: url(http://upload.wikimedia.org/wikipedia/commons/a/ab/Icons-mini-icon_clock.gif);
}
<ul>
  <li class="b1">The dog is big</li>
  <li class="b2">The dog is small</li>
  <li class="b3">The dog is medium sized</li>
</ul>
like image 197
thirtydot Avatar answered Sep 21 '22 17:09

thirtydot


Use list-style-image: url(imagename); to replace the bullets entirely with images. The downside of this method is that each browsers positions the images differently. CSS background images for list bullets is a more consistent method.

from http://css.maxdesign.com.au/listamatic/vertical04.htm

like image 43
corroded Avatar answered Sep 22 '22 17:09

corroded