Css to Select/Style First Word

CSS to select/style first word

What you are looking for is a pseudo-element that doesn't exist. There is :first-letter and :first-line, but no :first-word.

You can of course do this with JavaScript. Here's some code I found that does this: http://www.dynamicsitesolutions.com/javascript/first-word-selector/

Style the first word of a sentence with CSS

You'll need to either change the HTML to place the first word in a span that you can select CSS, or you need to use JavaScript to detect the first word, then use JavaScript to place that word ina span that you can select with CSS.

There is only one way to accomplish this. Create your own browser application, and add support for a :first-word pseudo-element selector.

Color the First word of Sentence CSS

Try this, hope this will help .

.logoS:before {  color: red;  content: "Title ";}
<div class="logoS">Of The Page</div>

target first letter of each word in css

You should wrap every single word with a tag and use ::first-letter CSS selector .

Also, note that this selector does not work on inline elements. If you want to use it with an inline element, such a <span>, make sure you set display:inline-block (see here for more details: https://stackoverflow.com/a/7631782/11298742)

example :