htmlcsscss-selectors

css bold first word


How can I bold the first word of sentence using CSS selectors and is this a good/bad way to do this with respects to browser comparability?

code:

<h2>this is a sentence</h2>

Solution

  • 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.