如何在p标签中对asterix第一个字符着色 [英] How to color the asterix first character in a p tag
本文介绍了如何在p标签中对asterix第一个字符着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我认为这很容易使用 :: first-letter
伪元素,但它不工作!
I thought this would be easy using the ::first-letter
pseudo element but it doesn't work!
我有
<p>* Required Fields</p>
,我想让*变成红色!
任何想法?注意我无法更改html。
Any ideas? Note I can't change the html.
推荐答案
几乎有一个解决方案一个解决方案),它与您的HTML:
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;
}
我推出了一个虚拟机在IE上测试,看起来不错:
I launched a virtual machine to test on IE, it looks good :
>
这篇关于如何在p标签中对asterix第一个字符着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文