Bold text tag in html

— жирное выделение текста

HTML-элемент является частью текста стилистически отличающейся от нормального текста, не носящий какого-либо специального значения или важности, и как правило выделен жирным шрифтом.

Content categories (en-US) Flow content (en-US) , phrasing content (en-US) , palpable content.
Разрешённый контент Phrasing content (en-US) .
Tag omission Нет, открывающий и закрывающий теги обязательны.
Permitted parents Any element that accepts phrasing content (en-US) .
Permitted ARIA roles Any
DOM interface HTMLElement Up to Gecko 1.9.2 (Firefox 4) inclusive, Firefox implements the HTMLSpanElement interface for this element.
Читайте также:  Php include path config

Атрибуты

Указания по применению

  • Используйте в таких случаях, как ключевые слова в кратком содержании, имена продуктов в отзыве, или других частях текста, которые обычно выделяют жирным.
  • Не путать элемент с , , или элементами. Элемент представляет собой текст определённой важности, делает некий акцент на тексте, и элемент представляет собой текст определённой значимости. Элемент не содержит специальной семантической информации, используйте его только в том случае, если другие не подошли.
  • Также не помечайте заглавия и заголовки элементом . Для этих целей используйте элементы с (en-US) до (en-US) . К тому же CSS может изменять стандартный вид этих элементов, в результате чего они не всегда будут выделены жирным текстом.
  • Хорошей практикой является использование атрибута class на элементе для того, чтобы передать дополнительную семантическую информацию (например, для первого предложения в абзаце). Это упрощает разработку различных стилизаций веб-документа без надобности менять его HTML-код.
  • Исторически, элемент был задуман для выделения текста жирным шрифтом. Информация о стилизации устарела, начиная с HTML4, значение элемента было изменено.
  • Если нет семантической причины использовать элемент , использование css свойства font-weight (en-US) со значением bold будет более грамотным выбором для изменения толщины текста.

Пример

p> В этой статье описывается элемент для форматирования b class="keywords">текстаb>. Она объясняет его использование в документе b class="keywords">HTMLb>. p> 

Ключевые слова с тегом , отображаемые со стилем, выделены жирным шрифтом.

Спецификации

Браузерная совместимость

BCD tables only load in the browser

Смотрите также

Found a content problem with this page?

This page was last modified on 13 дек. 2022 г. by MDN contributors.

Your blueprint for a better internet.

MDN

Support

Our communities

Developers

Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998– 2023 by individual mozilla.org contributors. Content available under a Creative Commons license.

Источник

HTML Text Formatting

HTML contains several elements for defining text with a special meaning.

Example

This is subscript and superscript

HTML Formatting Elements

Formatting elements were designed to display special types of text:

  • — Bold text
  • — Important text
  • — Italic text
  • — Emphasized text
  • — Marked text
  • — Smaller text
  • — Deleted text
  • — Inserted text
  • — Subscript text
  • — Superscript text

HTML and Elements

The HTML element defines bold text, without any extra importance.

Example

The HTML element defines text with strong importance. The content inside is typically displayed in bold.

Example

HTML and Elements

The HTML element defines a part of text in an alternate voice or mood. The content inside is typically displayed in italic.

Tip: The tag is often used to indicate a technical term, a phrase from another language, a thought, a ship name, etc.

Example

The HTML element defines emphasized text. The content inside is typically displayed in italic.

Tip: A screen reader will pronounce the words in with an emphasis, using verbal stress.

Example

HTML Element

The HTML element defines smaller text:

Example

HTML Element

The HTML element defines text that should be marked or highlighted:

Example

Do not forget to buy milk today.

HTML Element

The HTML element defines text that has been deleted from a document. Browsers will usually strike a line through deleted text:

Example

My favorite color is blue red.

HTML Element

The HTML element defines a text that has been inserted into a document. Browsers will usually underline inserted text:

Example

HTML Element

The HTML element defines subscript text. Subscript text appears half a character below the normal line, and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O:

Example

HTML Element

The HTML element defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font. Superscript text can be used for footnotes, like WWW [1] :

Example

This is superscripted text.

HTML Exercises

HTML Text Formatting Elements

Tag Description
Defines bold text
Defines emphasized text
Defines a part of text in an alternate voice or mood
Defines smaller text
Defines important text
Defines subscripted text
Defines superscripted text
Defines inserted text
Defines deleted text
Defines marked/highlighted text

For a complete list of all available HTML tags, visit our HTML Tag Reference.

Источник

Bold Font in HTML – Font Weight for Letters

Kolade Chris

Kolade Chris

Bold Font in HTML – Font Weight for Letters

When you’re building a website, you may want to place particular emphasis on certain text to let users know that it’s important.

And you can do this in HTML with various text formatting tags.

In this article, I will take you through how to emphasize certain text by making it bold.

In HTML, there are three major ways that you can use to make text bold. You can use the tag, the tag, or you can do it in CSS with the font-weight property. Let’s look at each method in more detail.

How to Make Text Bold With the Tag in HTML

HTML gives us the tag for making text bold. To make text bold with this tag, you need to wrap it around the text like this:

This text is bold, but this text is not.

bold-with-b-tag

As you can see in the image, the tag makes part of the text stand out.

How to Make Text Bold With the Tag in HTML

With the tag, you are not just making the text bold – you are calling special attention to it.

also makes text bold just like the tag, but there is a slight difference between the two. I’ll discuss this later in the article.

Just like the tag, you need to wrap the tag around the text to make the text bold with it.

 

Before paying to learn programming, check out freeCodeCamp.

bold-with-strong-tag

With the tag, the freeCodeCamp text isn’t just bold, it has a semantic meaning and emphasis.

How to Make Text Bold with the CSS font-weight Property

The font-weight property takes lighter , bold , and bolder as values. It also takes numbers from 100 to 900. So, with it, you don’t just make text bold, you can also make it lighter than its surrounding text.

To make some text bold with the font-weight weight property, you need to select the text with its class, id (if any), or element and then apply the values you want. Here’s how it works:

This is a lighter text.

This is a bold text.

This is a bolder text.

bold-with-fontweight

Should You Use , or font-weight to Make Text Bold?

You might be wondering which to use for making text bold – , , or the CSS font-weight property.

You should generally avoid using because it’s already a style. When you make text bold with the tag, you’re explicitly telling the browser to make the text bold right from the HTML.

also makes the text appear bold, but it is semantic. With it, you’re not styling from the HTML (which HTML was never meant for originally), but rather you’re telling the browser to make the text appear stronger in appearance than other surrounding text.

The CSS font-weight property gives you more control over how light or bold the text should be. The values lighter , bold , and bolder are a start, but you can take things a step further by applying numbers/weights like 100 200 , 300 , 400 , 500 , 600 , 700 , 800 , and 900 as values, which gives different variations of lightness and boldness.

Conclusion

Bold font helps you place emphasis on certain words in HTML. In this article, you’ve learned about the 3 different ways you can make text bold, as well as which of them is best to use.

Thank you for reading, and keep coding.

Источник

HTML Bold Text Tutorial – How to Use the b Tag

HTML Bold Text Tutorial – How to Use the b Tag

In this article, we are going to learn how to use the tag and how it differs from the tag.

What is the (bold) tag in HTML?

The tag is used to to make a portion of the text bold without carrying any special importance. Here is an example using the tag.

This is an example of bold text.

bold-text

According to the HTML Living Standard, the tag can be used with the following examples:

key words in a document abstract, product names in a review, actionable words in interactive text-driven software, or an article lede.

Here’s an example of using for a product name in a review

The Sennheiser IE 300 Headphones fit well in your ears and have an incredible sound.

headphones-bold-text-1

The tag is meant to bring the user’s attention to a span of text. It is not supposed to carry any importance or convey a tone of urgency or seriousness.

This would be an incorrect use of the tag.

WARNING!! This area is dangerous.

The appropriate tag for this situation would be the tag because it conveys a sense of seriousness.

Differences between the tag and tag in HTML

When I first started learning HTML, I thought that the tag and tag were the same thing. Part of the confusion is that they both have the same default boldface styling in most browsers.

One key difference is that tags should be used when the text has strong importance, or a sense of urgency or seriousness. tags, on the other hand, should be used to bring attention to a span of text without increased importance.

This example of the tag tells the user what list item should be read first and that it holds more importance than the other two list items.

to-do-list-

Another key difference is that tags should not be used in headings and captions whereas tags can.

Here is an example using the tag to place importance on the title of the chapter.

Chapter 5: The Battle

How to Use the Class Attribute with Tags in HTML

It is common to add a class attribute in the tag to add more semantic meaning.

If you have a series of sentences, you can add a class like this to the first

tag and that will mark it as the lead sentence.

 

A young boy reunites with birth mother

A six year old boy unexpectedly meets his birth mother at the local grocery store.

A young boy and his grandfather were shopping at the grocery store, when a young woman approached them from behind.

[. ]

Should you use the tag for styling text in HTML?

In HTML 5, it is not appropriate to use the tag for styling text. The preferred styling method is to use the CSS font-weight property.

Example using the keyword of bold

 

I am using CSS to make the text bold.

Example using numeric values

using-font-weight

Conclusion

While, tags and tags might look similar in the browser, they do have different meanings. It is important to know the difference between the two so you can use them appropriately.

tags are used to bring attention to a span of text but hold no special importance. tags on the other hand, should be used if the text conveys a sense of importance, seriousness, or urgency.

I hope you enjoyed this article and learned about when to use tags.

Источник

Оцените статью