gpt4 book ai didi

html - 仅更改文本的前 6 个字符的颜色 css

转载 作者:太空狗 更新时间:2023-10-29 13:19:15 24 4
gpt4 key购买 nike

我有短语作为 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 ";
}

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

关于html - 仅更改文本的前 6 个字符的颜色 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12218448/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com