2

Throughout the text and the titles on my webpage I need to make certain words bold and others need to be highlighted in a color.

I know before I would have used a

<b> 

or perhaps a

<strong>

What is the HTML5 markup practice?

Also, do I need different markup for a bold word compared with a word that is just highlighted? Would a styled span suffice?

This is <span class="highlight">highlighted</span> and this is <b>bold!</b>

And what should I do in titles:

<h1>The title is <b>awesome</b></h1>
panthro
  • 22,779
  • 66
  • 183
  • 324

1 Answers1

3

HTML5 practices are all about semantics. If your bold text is bold because you want to place a strong emphasis on that text, you should use <strong>. If your highlighted text is highlighted because it's something you want to mark to draw attention to it, try the <mark> element. Style those elements as you wish.

You will <strong>probably</strong> find most browsers 
have quite sensible defaults for <mark>styling these 
elements</mark>.
Matt Gibson
  • 37,886
  • 9
  • 99
  • 128