开发者

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

开发者 https://www.devze.com 2022-12-24 13:59 出处:网络
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 t

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

精彩评论

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