文本阴影或与<ul>项目符号类似的效果?



正如标题所述,我正在尝试找到一种为子弹添加文本阴影效果的方法。我正在使用文字阴影在某些文本后面显示出光线,我想在不必创建自己的子弹图像的情况下完成同样的效果。

尝试此

ul {
  list-style: none;
}
li:before {
  content: '2022';
  padding: 10px;
  text-shadow: 1px 1px 2px red;
}

http://jsbin.com/apoviv/2/edit

UPD:您真的可以使用Unicode Charachtest进行特殊符号,这很棘手,但是有很好的文章可以帮助http://css-tricks.com/css-content/

您最好的选择是使用伪元素插入子弹和子弹符号(或其他适合您的其他符号)。由于它将是文本内容,因此文本阴影将完美地在其上

这是一个例子 - http://dabblet.com/gist/4356335-具有一些额外的样式来使插入子弹工作。

另一个选择是使用纯CSS子弹。这样的东西:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
            <title>CSS Bullets</title>
        <style type="text/css" media="screen">
            html, body {
            font-size: 16px; 
        }
        article ul li {
            position:relative;
            overflow:hidden;
            list-style:none;
            padding-left:20px;
            line-height: 1.35em;
            margin: 0 0 .5em 0;
        }
        article li:before {
            margin:-8px 0 0;
            background:#ededed;
            overflow:hidden;
            list-style:none;
            content:"";
            position:absolute;
            top:0.95em;
            left:0;
            width:7px;
            height:7px;
            border-radius:2px;
            -webkit-border-radius:2px;
            -moz-border-radius:2px;
            box-shadow: 1px 1px 5px #888888;
        }
        </style>
    </head>
<body>
    <article>
        <ul>
            <li>Bullet 1</li>
            <li>Bullet 2</li>
            <li>Bullet 3</li>
        </ul>
    </article>
</body>
</html>

最新更新