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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -