简体   繁体   English

李项目符号需要背景色

[英]li bullet point needs background color

I want my <li> list items bullet point to be included with the background color of the list. 我希望我的<li>列表项目项目符号要包括在列表的背景色中。 It currently looks like the second example where the bullet point has no background color, but I want it to look like the first: 当前看起来像第二个示例,其中项目符号点没有背景色,但我希望它看起来像第一个:

在此处输入图片说明

How would I add the background color to the bullet point? 如何将背景色添加到项目符号点?

You want this. 你要这个。

li {
  list-style-position: inside;

}

 ul { display: inline-block; } li { list-style-position: inside; background: orange; } 
 <ul> <li>Item1</li> <li>Item2</li> <li>Item3</li> <li>Item4</li> <li>Item5</li> </ul> 

Your question is not easy to understand. 您的问题不容易理解。 Could you post an example of your code for us to help you better please? 您能否为我们发布代码示例,以帮助您更好?

From what I can make out, you have a li that you want to add a background colour to, but you don't want it to start after the dot ( ), but include the dot as well? 从我可以做出来,你有一个li要添加背景颜色,但你不希望它在dot(后开始 ),但包括点呢?

The property you are after is: list-style-position: inside; 您所追求的属性是: list-style-position: inside;

 li { background-color:red; list-style-position: inside; } 
 <ul> <li>asdf</li> <li>qwer</li> <li>zxcv</li> </ul> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM