Difference between <strong> and font-weight: bold;

so why is there both? in html you can have

i am bold

.
so is font-weight: bold; in css just another way to do it?

Hello @giga4349672881. The <strong> tags are used for certain words within a <p> or other text tag. You could as easily use a <span> tag, and style that, but that takes more space.

Changing the font-weight to bold just affects how the text looks in the browser. Using <strong> gives syntactic significance to the text such that screen readers and web scrapers can use to understand which text is important.

2 Likes

<strong/> and <em/> give an aural indication, or change of voice to enclosed text. This is semantic emphasis.

<b/> and <i/> give visual indication only, and will not give a change of voice. Sometimes we just want to visually separate font-style from the norm, without adding any emphasis to the text.

When all we want is bold text, or italic text, without any aural emphasis, then use CSS, or the latter two tags. Always think of the person on the other side of the screen reader. If we emphasize too much it will come across as being yelled at and the user may leave the page.

Think in terms of accessibility when choosing markup.

1 Like