[英]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.