How to use hex value for bullet in CSS

This question already has an answer here:

  • Adding HTML entities using CSS content 9 answers

  • 使用:before:after

    .mybullet:before
    {
        content: "2022";
        color: #f00;
        display: inline-block;
    }
    

    .mybullet:before {
      content: "2022";
      color: #f00;
    }
    <table>
      <tr>
        <td>
          <span class="mybullet" /> <a href="#">Link1</a>
        </td>
      </tr>
    </table>

    您需要将::before伪元素添加到您的代码中:

    .mybullet::before {
        content:"2022 ";
        color:#f00;
    }
    <table>
        <tr>
            <td><span class="mybullet" /> <a href="#">Link1</a>
    
            </td>
        </tr>
    </table>

    use :before or :after

    <span/> to <span></span>

    .mybullet:before
    {
        content:"2022 ";
        color:#f00;
        display: inline-block;
    }
    <table>
        <tr>
            <td>
                <span class="mybullet"> <a href="#">Link1</a></span>
            </td>        
        </tr>
    </table>
    链接地址: http://www.djcxy.com/p/15540.html

    上一篇: 如何设置为&#8211;

    下一篇: 如何在CSS中使用十六进制值作为项目符号