开发者

Is there a way to arrange the alignment of List Items (LI) when using an image as a bullet?

I have the following CSS

.ul{
    list-style-image:url(/images/bullet.png)
}

My bullet.png is 20 x 20px however it is displaying the text at the bottom of the image while I need to display my text in the middle of开发者_如何学Python the image. Is there a way to assign margins and paddings that move only the text?


Reset the paddings and margins.

Use background-image property and set a padding of the size of the image (and more if you want some space between your bullet and your text)

li
{
  margin: 0;
  padding: 0 20px 0 0;
  background-image:url(/images/bullet.png);
  background-repeat: no-repeat;
}


Not really. You can try removing the bullets, put padding on the LI and a background-image aligned left and center: background: url(images/bullet.png) no-repeat left center;.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜