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 :
p span { display: inline-block; font-family: 'Roboto', sans-serif }p span::first-letter { color: red; font-weight: bold;}
<p><span>Lorem</span> <span>ipsum</span> <span>dolor</span> <span>sit</span> <span>amet</span></p>
css bold first word
There is no ::first-word
pseudo-element in CSS; you'll have to wrap the first word in an extra element and then select that.
Using jQuery, select first word of element and alter css
There is a first-letter and a first-line pseudo element but there is no first-word. You need the span.
Related Topics
Css Files Are Not Loading in Laravel View
Why Does Applying a Css-Filter on the Parent Break the Child Positioning
Change Navbar Color in Twitter Bootstrap
How to Remove Focus Border (Outline) Around Text/Input Boxes - Chrome
Reset/Remove CSS Styles For Element Only
Media Queries: How to Target Desktop, Tablet, and Mobile
Why Is a Flex Item Limited to Parent Size
Fill Remaining Vertical Space With CSS Using Display:Flex
How Are the Points in CSS Specificity Calculated
Using Percentage Values With Background-Position on a Linear-Gradient
Css Transform Doesn't Work on Inline Elements
Bootstrap Navbar With Left, Center or Right Aligned Items
How to Center Floated Elements