Bold or italics in text is often used by sighted users as described in style guides to represent book titles or other citations. How does this impact users with disabilities and users that access your site with a screen reader?
What not to use
Both <b>
and <i>
tags are considered WCAG compliance errors. Don’t use them.
Using a style element style="font-weight:bold"
is not accessible. It only changes the appearance of the text and does nothing to convey meaning to any screen reader user. If this is a purely visual decoration this should be in your stylesheet
not inline in your content.
Headings are often bold, but they should not be use simply to bold text. They are used by many users to navigate the content of a page and provide structure to your content.
Screen Readers and Bold Text
While a sighted user can see text marked with <em>
or <strong>
tags most non-sighted screen reader users won’t have the same notation available since screen readers don’t acknowledge <em>
or <strong>
unless they use a specific one and turn on the setting. Most users don’t change the defaults on anything though so this is unlikely to be a use case that could be viably considered.
What to do instead of bold?
Gov.uk has a great look at this with their Warning text. If you click through to the HTML version you’ll see a visually hidden piece of text that says Warning
.
<div class="govuk-warning-text">
<span class="govuk-warning-text__icon" aria-hidden="true">!</span>
<strong class="govuk-warning-text__text">
<span class="govuk-visually-hidden">Warning</span>
You can be fined up to £5,000 if you do not register.
</strong>
</div>
Using this Warning
text means that users of screen readers get the semantic meaning of the text while visual users do not see the extra warning and instead see the styled text with a graphical element denoting that the piece of text is something to take extra note of. This is the same type of notation that is recommended by Deque University
In general text your text-level semantics should be treated as a progressive enhancement instead of required to make what you’re writing understandable. If you need a bold element to make your content have the emphasis you feel it needs that’s likely a sign of bad writing. Your text should put the emphasis on the right point without the need for any extra bold markup
Is the <em>
or <strong>
tag the best element to describe what you’re trying to emphasize?
<cite>
is intended for short citations such as book titles.
<var>
is designated to represent variables or computer code and mathematical equations.
<code>
is for longer blocks of code or for the code references you note here
<kbd>
is designated to specify key presses to be typed be a user.