I want to change the HTML li tag bullets color with CSS, is that possible?
<html> <head> <title>change li tag bullets color</title> </head> <body> <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul> </body> </html>
I would recommend diving into the CSS to do this. Like you could do something like this:
CSS
ul {
list-style: none; /*removes the default bullets*/
}
ul li::before {
content: "(find a bullet from online and copy/paste it here)";
color: "(whatever color you want)";
font-weight: "(if you want it to be bold or italicized)";
display: inline-block; /*for spacing purposes*/
width: 1em; /*Also for spacing but you can change it to whatever*/
margin-left: -1em; /*Also for spacing*/
}
<html> <head> <title>change li tag bullets color</title> <style> ul li::before { content: "\2022"; color: red; font-weight: bold; display: inline-block; width: 1em; margin-left: -1em; } </style> </head> <body> <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul> </body> </html>
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.