How to color specific word in a container using CSS

后端 未结 14 1708
不思量自难忘°
不思量自难忘° 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:48

    Use for this.

    This is a red apple

    CSS:

    .red {
    color: red;
    }
    

    Edit
    It isn't possible without any additional Javascript or HTML. According to the CSS3 specification there is no such selector (There were thoughts about a :contains() selector for CSS3). Also see this and this Question.

提交回复
热议问题