繁体   English   中英

更改css中的html li标签项目符号颜色

[英]change html li tag bullet color in css

我想用 CSS 改变 HTML li 标签的子弹颜色,这可能吗?

 <html> <head> <title>change li tag bullets color</title> </head> <body> <ul> <li>HTML</li> <li>CSS</li> <li>JavaScript</li> </ul> </body> </html>

我建议深入研究 CSS 来做到这一点。 就像你可以做这样的事情:

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>

暂无
暂无

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

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