This an article about how to align bullet image of an unordered list(ul). When you start slicing a PSD to html you will come across a number of times to align bullet images in an unordered list(ul). This will be a nail biting if you don’t know the correct css/xhtml trick. Once you read this article you will not scratch your head thinking how to align bullet image using CSS/HTML. Let’s look at the problem scenario.
Here is a simple example that you may need to code in css/html using unordered lists. Look at the image below.
Code snippet will look like below.
<ul> <li>Automation</li> <li>Has Offical</li> <li>Easy to Use</li> </ul>
Your css coding will look like below,
.ul{list-style-image:url(images/bullet.jpg);}
The above css class will place the custom bullet image for your unordered list. But it will cause following miss alignment.
Unordered list bullet image alignment using css/html
To solve above css error you can use the css code below .
.ul{list-style-type:none;} .ul li{background:url(images/vgreen.png) left top no-repeat; padding-left:30px;margin-top:10px;line-height:21px; }
padding-left will give the gap between image and the text.
You need to set background position top left in order to align the text and bullet image. top margin will adjust the the gap between list items. line height will align the image and the text into one line. once the above style class is applied you will get a CSS/HTML output like the below-mentioned image.
9 Comments
Join the discussion and tell us your opinion.
Pretty nice post. I just stumbled upon your blog and wanted to say that I have really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!
Aw, this was a really quality post. In theory I’d like to write like this too – taking time and real effort to make a good article… but what can I say… I procrastinate alot and never seem to get something done.
Easily, the article is in reality the sweetest on this deserving topic.
Good post. I study one thing more difficult on totally different blogs everyday. It’ll always be stimulating to learn content from other writers and observe a bit of one thing from their store. Id prefer to use some with the content material on my weblog whether you dont mind. Natually Ill offer you a hyperlink in your net blog. Thanks for sharing.
There are some interesting time limits on this article however I dont know if I see all of them center to heart. There may be some validity however I will take maintain opinion till I look into it further. Good article , thanks and we wish more! Added to FeedBurner as well
With this web site post you might have assist me to locate the facts which I need to get a lot more info. Thanks for that!
Yeah!!!! This is exactly what I was looking for….
Thanks for sharing!!!!!!!!
Nicely done. Thanks for sharing this information. Will be tweeting this.
Hi Anne,
Hope it helps…
Cheers!