How to color the asterix first character in a p tag

前端 未结 1 1663
时光取名叫无心
时光取名叫无心 2021-02-07 20:00

I thought this would be easy using the ::first-letter pseudo element but it doesn\'t work!

I have

* Required Fields

1条回答
  •  孤街浪徒
    2021-02-07 20:08

    I almost have a solution (well, you might see it as a solution) and it works with your HTML :

    p::before {
        content:'*';
        position:absolute;
        color: red;
        text-shadow: 0 0 1px red;
    }
    

    Demonstration

    I launched a virtual machine to test on IE, it looks good :

    enter image description here

    0 讨论(0)
提交回复
热议问题