我有短语作为 Client Testimonial
我只想更改 Client
我只使用了 first-letter
但有什么方法在 css 中更改颜色.. 请不要使用 javascript。
最佳答案
使用 :before
怎么样?
我会将文本从“Client Testimonial”更改为“Testimonial”,然后使用 CSS 应用 :before
规则:
HTML:
<div class="word">Testimonial</div>
CSS:
.word {
color: black;
}
.word:before {
color: red;
content: "Client ";
}
关于html - 仅更改文本的前 6 个字符的颜色 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12218448/