简体   繁体   中英

li bullet point needs background color

I want my <li> list items bullet point to be included with the background color of the list. 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?

The property you are after is: list-style-position: inside;

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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