Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <b> Tag

The <b> tag displays text in bold.

This tag highlights text in bold, but without special importance.

For important text that needs bolding, use the <strong> tag.

Example

#

A <b> tag that boldens the word 'Monday'.

Let's go visit the Louvre in Paris on Monday.

<p>Let's go visit the Louvre in Paris on <b>Monday</b>.</p>
b = bold

More Examples

A couple <b> tags that highlight some text fragments.

Cézanne's early work is often concerned with the figure in the landscape and includes many paintings of groups of large, heavy figures in the landscape, imaginatively painted.

Later in his career, he became more interested in working from direct observation and gradually developed a light, airy painting style

<p>
  Cézanne's <b>early work</b> is often concerned with the figure 
  in the landscape and includes many paintings of groups of large, 
  heavy figures in the landscape, imaginatively painted. 
</p>
<p>
  <b>Later in his career</b>, he became more interested in working 
  from direct observation and gradually developed a light, 
  airy painting style
</p>

Tip: The bold tag has been called an 'element of last resort'. There are alternative approaches, particularly CSS, which give you more control.


Attributes for <b>

The <b> element has no attributes, but it does accept global attributes. The following are occasionally used.

Attribute Value Description
id   value Provides the b element with a unique identifier.
class   classnames Assigns one or more classnames to the b element.
style   CSS-values Assigns CSS style values to the b element.

For additional global attributes see our global attributes list.


Did you know?

Did you know?

Difference between <b> and <strong>

The <b> and <strong> elements both make the text appear in bold.

In the early days of HTML, the <b> tag was used to emphasize or highlight text.

When semantic tags were introduced in HTML5, the <strong> tag became the preferred approach to display important text that requires emphasis or highlighting.


Text Tags

The <b> tag is part of a group of tags that are used to create and format text documents. This group is referred to as the Text tag group. Together, they allow you to create comprehensive HTML text documents.

Here is a list of text tags.

Element Description
<h1>-<h6> Defines text headings in 6 different sizes
<p> Creates a paragraph
<span> Container for one or more inline text elements
<br> Creates a line break
<sup> Specifies superscript text
<sub> Specifies subscripted text
<u> Specifies underlined text
<i> Specifies italic text
<b> Specifies bold text
<em> Marks text that needs emphasis
<strong> Indicates text that is important or with high urgency
<del> Defines deleted text
<ins> Defines inserted text
<ruby> Represents a small annotation with pronunciation of text
<kbd> Specifies keyboard input, such as, CTRL or ALT
<wbr> Specifies a preferred word-break location for long words

Browser support

Here is when <b> support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like


Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides