I\'m attempting to either use jQuery, CSS or PHP to increase the font size of the first letter of each word in a string. For example, I\'m going to have a title in h1 tags
I couldn't get :first-letter to work, but here's a possible solution, assuming the does not contain additional tags or entities:
$('h1').html(function(i,html){
return html.replace(/(\S)(\S*)/g, '$1$2');
});
CSS:
.FirstLetter {color:green}
A possible benefit here is that this should work on all browsers.
The regex is fairly simple: \S stands for a non-whitespace character. It matches word by word and captures the first letter in each word in the first group ($1), and the rest of the letters in the second group ($2), for an easy replace.
Working example: http://jsbin.com/ufovi4