How to color specific word in a container using CSS

后端 未结 14 1736
不思量自难忘°
不思量自难忘° 2020-12-15 05:01

Suppose I have a container:

 
This is a red apple

How to color a word \"red\" with red color? Some

14条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-15 05:46

    If you don't want to add html/javascript the simpel answer is NO you can't

    Take a look at the following specification http://www.w3.org/TR/css3-selectors/#selectors

    That are all available selectors for CSS3 and therefor it's simply impossible, and that's your answer.

    You have 2 options left without changing the content one is all ready described here:

    • javascript
    • server-side parsing so everything gets wrapped with the span tag

提交回复
热议问题