Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Style UL with Sprite Image

Wondering if it is possibly to use a sprite image to replace the ul list default bullet. Is this possible?

like image 983
mcbeav Avatar asked Nov 20 '25 20:11

mcbeav


2 Answers

Lists have the list-style-image property, but it is often too inflexible.

You can usually get it working with something like this...

ul {
   list-style: none;
}

ul li {
   padding: 3px 0 3px 35px;
   background: url(images/layout/bullet.png) no-repeat left center;
}

A sprite is not generally a good idea for this - unless you space them all vertically and allow sufficiently enough vertical margins so the list item doesn't grow too large and have other sprites bleed through.

like image 88
alex Avatar answered Nov 23 '25 11:11

alex


ya sure its possible

first you remove the bullet style for the li tag

list-style:none;

Then give background-image for the li tag

like image 45
Anish Joseph Avatar answered Nov 23 '25 10:11

Anish Joseph



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!