Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to color the asterix first character in a p tag

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

I have

<p>* Required Fields</p>

and I want the * to be red!

Any ideas? Note I can't change the html.

http://jsfiddle.net/3ducS/

like image 474
PedroKTFC Avatar asked Jul 24 '13 13:07

PedroKTFC


1 Answers

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

like image 50
Denys Séguret Avatar answered Oct 24 '22 23:10

Denys Séguret