How to make text bold in HTML?

I am trying to make the text bold using HTML, but I am trying to get it to work.

Here is what I am trying:

Some <bold>text</bold> that I want emboldened. 

Can someone tell me what I am doing wrong?

+75
html css html5
Jul 04 '09 at 14:56
source share
10 answers

use the <strong> or <b>

Alternatively, you can try css <span style="font-weight:bold">text</span>

+129
Jul 04 '09 at 14:59
source share

HTML does not have a <bold> , instead you will need to use <b> . Note, however, that using <b> now discouraged in favor of CSS . You would be better off using CSS to achieve this.

The <strong> is a semantic element for strong accent, which defaults are in bold.

+35
Jul 04 '09 at 15:00
source share

Markup Method:

 <strong>I'm Bold!</strong> and <b>I'm Bold Too!</b> 

Way of styling:

 .bold { font-weight:bold; } <span class="bold">I'm Bold!</span> 

From: http://www.december.com/html/x1/

<b>

This element contains text that the browser should display in bold. Since the value of element B determines the appearance of the content that it covers, this element is considered a โ€œphysicalโ€ markup element. Thus, it does not convey the meaning of the semantic markup element, such as strong.

<strong>

Description This element encloses text in brackets that must be emphasized. Stronger than the em element.

+11
Jul 04 '09 at 14:59
source share

Can someone tell me what I am doing wrong?

โ€œboldโ€ has never been an HTML element (โ€œbโ€ is the closest match).

HTML should contain structured content; The CSS publisher should offer styles for this content. In this way, user agents can reveal structured content using useful styles and navigation controls for users who cannot see your proposed bold style (for example, search engine users, completely blind users using screen readers, visually impaired users, using their own colors and fonts, geeky users using text browsers, users of voice browsers such as Opera for Windows). So the right way to make the text bold depends on why you want to style it in bold. For example:

  • Want to distinguish headings from other text? Use header elements (from "h1" to "h6") and offer them a bold style for your CSS ("h1, h2, h3, h4, h5, h6 {font-weight: bold;}".

  • Want to strip ethics for form fields? Use the "label" element, programmatically associate it with the corresponding "select", "input" or "textarea" element, giving it the "for" attribute, corresponding to the "id" attribute for the target, and suggest a bold style for this inside your CSS (" label {font-weight: bold; "}).

  • Want to underline a heading for a group of related fields in a form, such as a group of radios? Surround them with the "fieldset" element, give it the "legend" element and suggest a bold style for it in your CSS ("legend {font-weight: bold;)").

  • Want to distinguish a table title from a table that it signs? Use the caption element and suggest a bold style for it in your CSS ("caption {font-weight: bold;)").

  • Want to distinguish table headers from table data cells? Use the "th" element and suggest a bold style for it in your CSS ("th {font-weight: bold;)").

  • Want to distinguish the name of the mentioned movie or album from the surrounding text? Use the "cite" element with the class ("cite class =" movie-title ") and suggest a bold style for it in your CSS (" .movie-title {font-weight: bold;} ").

  • Want to distinguish a specific keyword from the surrounding text that defines or explains it? Use the "dfn" element and suggest a bold style for it in your CSS ("dfn {font-weight: bold;}").

  • Want to distinguish some computer code from the surrounding text? Use the "code" element and suggest a bold style for it in your CSS ("code {font-weight: bold;)").

  • Want to distinguish a variable name from surrounding text? Use the "var" element and suggest a bold style for it in your CSS ("var {font-weight: bold;)").

  • Want to indicate that some text has been added as an update? Use the "ins" element and suggest a bold style for it in your CSS ("ins {font-weight: bold;)").

  • Want to emphasize some text ("I love kittens!")? Use the "em" element and suggest a bold style for it in your CSS (for example, "em {font-weight: bold;)").

  • Want to strongly emphasize some text, perhaps for a warning (" Beware of the dog! ")? Use a strong element and suggest a bold style for it in your CSS (for example, "strong {font-weight: bold;}").

... you get the idea (hopefully).

Can't find an HTML element with the right semantics to express / why / do you want to make this text bold? Wrap it in a generic span element, give it a meaningful class name that expresses your rationale for highlighting this text ("<span class =" lede "> Let me start this news article with a sentence that summarizes it. </span> ) and suggest a bold style for this in your CSS (".lede {font-weight: bold;"}. Before creating your own class names, you can check if there is a microformat (microformats .org) or a general convention for what you want to express.

+5
Jul 05 '09 at 19:20
source share

I think the real answer is http://www.w3schools.com/HTML/default.asp .

+3
Jul 04 '09 at 15:00
source share

Another option is to do it using CSS ...

eg. one

 <span style="font-weight: bold;">Hello stackoverflow!</span> 

eg. 2

 <style type="text/css"> #text { font-weight: bold; } </style> <div id="text"> Hello again! </div> 
+3
Jul 04 '09 at 15:03
source share

In Html use:

  • Some <b> text </b> that I want to encourage.
  • Some <strong> text </strong> that I want to encourage.

In CSS use:

  • Some <span style="font-weight:bold"> text </span> that I want to encourage.
+2
Jul 04 '09 at 14:58
source share

Its just <b> instead of <bold> :

 Some <b>text</b> that I want bolded. 

Note that <b> just changes the appearance of the text. If you want to make it bold because you want to express a strong accent, it is better to use the <strong> element.

+2
Jul 04 '09 at 14:58
source share

An HTML element defines bold text without any special meaning.

 <b>This text is bold</b> 

The HTML element defines strong text with added semantic "strong" meaning.

 <strong>This text is strong</strong> 
+2
Jun 11 '16 at 2:06
source share

You are almost there!

For bold text, you should have the following: <b> bold text</b> or <strong>bold text</strong> They have the same result.

Working example - JSfiddle

+1
Feb 14 '16 at 18:46
source share



All Articles