簡體   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