You cannot apply CSS to specific words, only elements (or the small set of pseudo-elements defined by CSS). Here's a JavaScript-based solution that never affects your markup:
function replaceTextUnder(node,pattern,str){
var t, walk=document.createTreeWalker(node,NodeFilter.SHOW_TEXT,null,false);
while(t=walk.nextNode()){
t.nodeValue = t.nodeValue.replace(pattern,str);
}
}
replaceTextUnder(document.body, /\bid\b/gi, "ID" );
Alternatively, here it is wrapped up as a jQuery plugin:
jQuery.fn.replaceInText = function(pattern,str){
return this.each(function(){
var t, walk=document.createTreeWalker(this,NodeFilter.SHOW_TEXT,null,false);
while(t=walk.nextNode()) t.nodeValue = t.nodeValue.replace(pattern,str);
});
};
$('li,td,th').replaceInText( /\bid\b/gi, "ID" );