html - Apply CSS to a singly word -


is possible apply css in such way detect whenever there word in element , mark word in way? know can add <span style="...">word</span> or <span class="...">word</span> inline html, won't automatically detect word. there way entirely in css? appreciated.

theres no way in css. replace instances of word wrapped version , apply style per example http://jsfiddle.net/w9vbp/:

js

var word = 'hello'; var replacement = '<span class="theword">' + word + '</span>';  var re = new regexp(word, 'ig');  document.body.innerhtml = document.body.innerhtml.replace(re, replacement); 

css

.theword {     color:red; } 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -