I have a website that I am developing using CSS3 and I have h1 tag for the title:
main title
Now I want t
CSS has no knowledge about words. The only thing existing is :first-letter and :first-line. A construct like a word and a pseudo element for last are not existing.
If you really want to have a workaround within one element, then you must use javascript to parse the last word out. I think the way you are going is the best way when you only have a few cases on the page.
If you use it for h1 then you should have it so or so only once on the page.