如何在p标签中对asterix第一个字符着色 [英] How to color the asterix first character in a p tag

查看:159
本文介绍了如何在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.

http:/ /jsfiddle.net/3ducS/

推荐答案

几乎有一个解决方案,您可能会看到它作为一个解决方案),它与您的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆