更改无序列表列表的项标记的颜色、大小和位置等的解决办法

耗尽温柔 提交于 2019-11-27 00:26:59

提示:如果仅更改列表项的颜色,设置li的颜色就可以,以下可以忽略。

例:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        ul {
            width: 200px;
            margin: 0 auto;
            padding: 0;
            list-style: none;
        }

        /*正方形*/
        ul li::before {
            content: "■";
            color: #F00;
        }
        
        /*实心圆*/
        ul li::before {
            content: "●";
            color: #0F0;
            position: relative;
            top: -1px;
            margin-right: 7px;
        }

        /*空心圆*/
        ul li::before {
            content: "○";
            color: #00F;
        }
    </style>
</head>
<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
    </ul>
</body>
</html>

  

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!