更改颜色css只有文本的前6个字符 [英] change color css only first 6 character of text

查看:1099
本文介绍了更改颜色css只有文本的前6个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有短语客户证言,我只想更改客户我只使用第一个字母,但在css中有任何方法更改颜色..没有javascript请。

I have phrase as Client Testimonial and i want to change only the Client i have used only first-letter but is there any method in css to change color .. no javascript please.

推荐答案

如何使用:之前

我会将文本从客户见证Testimonial,然后使用CSS应用:之前规则:

I would change the text from "Client Testimonial" to "Testimonial", and then with CSS apply the :before rule:

HTML:

<div class="word">Testimonial</div>​​​​​​​​

CSS

.word {
 color: black;       
}
.word:before {
 color: red;
 content: "Client ";
}

示例:http://jsfiddle.net/LvZt7/

这篇关于更改颜色css只有文本的前6个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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