I am trying to get the text in my list to align properly, but I can't get it right.
As you can see the text is slightly off and starts at the "image bullet" baseline. I want it to be in the middle.
Source:
//CSS
ul {
list-style-image:url(image/li.png);
list-style-position:outside;
margin:0; padding:0;
}
ul li {
margin:0; padding:0;
}
//HTML
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
You need to bring the bullet points inside the content flow by using list-style-position:inside; , and then center align the text.
You can use . parentOfUl{ text-align:center;} and then ul{ display:inline-block; }, and at last li{ text-align:center; }.
Now define your li
background image and define background position
according to your design
ul {
list-style:none;
margin:0; padding:0;
}
ul li {
margin:0; padding:0;
background:url('') no-repeat 0 0;
padding-left:40px; // according to your image with
min-height:40px; // according to your image height
}
Demo
DEMO2 As per OP's exact requirement
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With