How to color specific word in a container using CSS

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

    Here's some code that uses jQuery to wrap a class around the word red, which can be colored.

     
    This is a red apple
     $("#container:contains('red')").each(function(){
         $(this).html($(this).html().replace("red", "red"));
     });
    

提交回复
热议问题