开发者

CSS using images instead of bullets

开发者 https://www.devze.com 2023-02-13 03:43 出处:网络
I want to use three different images instead of bullets to create a lisli>t Example: <ul> <li>The dog is big</li>

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开发者_如何学Go medium sized</li>
</ul>

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


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>


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


you can use the list-style-image property.

ul.dogbig
{
  list-style-image:url("/images/dogbig.gif");
}


There is such a property of CSS but i think that it doesn't work for every different <li> element:

ul
{
list-style-image:url("/images/blueball.gif");
list-style-type:square;
}

I hope it would help you

0

精彩评论

暂无评论...
验证码 换一张
取 消