Tag B in HTML

Using tag b in HTML

The b tag in HTML is used to highlight text to draw the reader’s attention to the content of an element that would otherwise not be given much attention. This was formerly called the Boldface element, and most browsers still display text with this tag in bold type.

Example of tag b in HTML

However, using it to highlight text is undesirable. Instead, you should use the CSS font-weight property to create bold text or the strong tag to indicate that the text has special meaning.

Notes on using element b:

  • Use the b tag in cases such as keywords in a summary, product names in a review, or other pieces of text that will be bold (but not particularly important).
  • Do not confuse the b tag with the strong, em, or mark tags. The strong tag highlights text of particular importance, em emphasizes text, and the mark tag represents text of particular relevance. The b element does not convey such a special semantic load. Use it only when the others are inappropriate, as a last resort for displaying emphasis.
Before proceeding, <b>check</b> that you are wearing safety glasses
Before you continue, <strong>check that you are wearing safety glasses</strong>
Before you continue, check that <em>you are wearing</em> safety glasses
Before you continue, check that you have worn <mark>safety glasses</mark>
  • Similarly, do not tag titles and headings using the element b. Use h1 to h6 tags to do this. Also, style sheets can change the default style of these elements so that they don’t necessarily appear in bold.
<h2>Using tag <b> in HTML </h2>
Tag <b> in HTML is used to highlight text </b> to attract attention
  • It is recommended to use the class attribute in the b element to convey additional semantic information if necessary (e.g., b class=”lead” b for the first sentence in a paragraph). This makes it easier to manage multiple uses of the b tag if your stylistic needs change, without having to change all of its uses in HTML.
<b class="lead">check</b> that you are wearing <b class="lead">safety glasses</b>
  • Historically, the b element was intended to make text bold. Since HTML4, the style information is obsolete, so the meaning of the element has changed.
  • If there is no semantic purpose for using the element, you should use the font-weight CSS font-weight with a value of “bold” to make the text bold.

1 thought on “Tag B in HTML”

  1. Это потому, что элементы от b до точки с запятой в этот тег должны быть заключены, чтобы они отражали свободное пространство между этими знаками.
    На странице сайта этот тег можно использовать в следующих случаях:
    – для выделения отдельных фрагментов текста в пределах абзаца. Самый популярный вариант использования тега b включает его .
    – для выделения всего текста в рамках одного абзаца. Непосредственно перед абзацем этот тег выглядит как , чтобы выделить этот диапазон.
    – для выделения текста за пределами диапазона абзаца. Он тоже может быть реализован через указанный выше набор способов: b и знак .

Leave a Comment

Your email address will not be published.