?...">

Alternative to HTML Bold Tags

Okay, so I know that in HTML you can use the <b> , but is there a "weight=bold" attribute that I can use in the <p> ?

Or is it in CSS or Javascript?

+45
html css
Mar 16 '09 at 4:57
source share
18 answers

Also consider the <strong> . This is much better for screen readers and therefore better for accessibility. Search engines also use <strong> tags to identify important content, similar to how they use heading tags <h1> , <h2> , etc. (Although <b> will also have similar meaning for search engines). If you want to emphasize the importance of the text, use <strong> . If you do not want to emphasize importance, use the <b> or use the font-weight:bold; style font-weight:bold; for an element or CSS.

Although, if you highlight the entire paragraph, it's probably best to use the CSS parameter. This will reduce the impact on screen readers, and there is probably no point in underlining the entire paragraph. But, on the other hand, I saw a bold approach to emphasize a whole paragraph before, for good reason. In this case, font-weight:bold; is what you want to use, probably in class / style.

After all, <strong> , <b> or font-weight:bold; will work and perform something similar visually (maybe exactly the same), but they have slightly different meanings. Also, make sure that if you select a title, use the title tags: <h1> , <h2> , etc.

+59
Mar 16 '09 at 5:18
source share

You are thinking about the CSS font-weight property:

 p { font-weight: bold; } 
+47
Mar 16 '09 at 5:00
source share

If the meaning of the text is semantically strong, use the strong element. If not, use a semantic named class (one that clearly shows the value of an element, doesn't mix presentation and data, calling it bold , etc.) and referring to it in your CSS.

HTML

 <span class="important-message">I'm important!</span> 

CSS

 .important-message { font-weight: bold; } 

Some people still use element b as a presentation hook, but are not outdated , although most people prefer strong at the moment. Just make sure they are used correctly.

+20
Mar 16 '09 at 5:08
source share

The <b> tag is alive and well. & L; b> not outdated, but its use has been clarified and limited. & L; b> does not make sense and does not convey a vocal accent, for example, on the screen of a screen reader. & L; b> however, passes the printed empase , just like the <i> tag. Both have a certain place in typography, but not in colloquial speech, mes frères .

Quote from http://www.whatwg.org/

Element b is an interval of text that stylistically shifts from ordinary prose without emphasizing, such as keywords in an abstract document, product names in a review, or other text fragments whose typical typographic presentation is highlighted.
+9
Jul 22 '10 at 2:27
source share

In CSS you must set font-weight: bold; like style

+7
Mar 16 '09 at 5:01
source share

You can make text or words Bold using the <b>Text</b> .

You can also use the <strong>Text</strong>

The headings <h1> , <h2> , <h3> , ... are bold tags by default and make your text bold by default unless you change your style with CSS

The above tags were available in HTML, but if you want to change the style using CSS , you can use

 font-weight:bold 
+6
May 17 '11 at 12:48
source share

you can also do <p style = "font-weight: bold;" > bold text here </p>

+4
Mar 16 '09 at 5:03
source share

<b> - last resort

You can use <b> , but only as a last resort . There are many elements that work as good <b> alternatives, here they are in order of greatest utility:

More useful alternatives

  • For important text: <strong>
  • The underline text is underlined: <em>
  • For headings, not just page titles, but paragraph headings and other types: <h1> through <h6>

Practical Edge for Using <b>

The only time I will advocate the use of <b> is if

  • you created the <strong> style in a different way that you don’t need to display for the text that you mean

  • you don’t need italics or cursors, but

  • You are going to use an inline range or a range with a class for bold text only . (For example: <span class='bold'> )

Then it’s prudent to use <b> instead, because in this case it will probably be cleaner / shorter and more meaningful than the unaesthetic range, and sobriety / readability is a good reason to choose, since b has been overridden to be used as an element denoting a seal .

+3
May 11 '11 at 16:16
source share

Perhaps you want to use CSS classes?

 p.bold { font-weight:bold; } 

That way you can still use <p> as usual.

 <p>This is normal text</p> <p class="bold">This is bold text</p> 

Gives you:

This is plain text.

This is bold text.

+1
May 16 '11 at 23:38
source share

A very old thread, I know. - but for completeness:

I am using <span class="bold">my text</span>

when I load four font styles: normal; fatty; italics and bold italics to my website via css.

I feel that the result is better than just modifying the font, and closer to the designers we’ve decided what a bold font should look like.

The same goes for italics and boldik, of course, which gives me extra flexibility.

+1
Sep 15 '16 at 9:37
source share

You can use the font-weight attribute on

For example:

 <p>This is my paragraph</p> 

You can have inline CSS:

 <p style="font-weight:bold;">This is my paragraph</p> 

Or use it in your external CSS stylesheet, as shown below:

 p{ font-weight:bold; } 
+1
Nov 27 '17 at 12:43 on
source share

Everything is historical and dates back to the time when dinosaurs walked the earth, and CSS did not exist.

More seriously, forget about the b tag and use font-weight: bold in the CSS rule :)

0
Mar 16 '09 at 5:02
source share

In the side code below, the code will also make it bold.

 <strong> text here </strong> 
0
Mar 16 '09 at 7:48
source share
 <p style="font-weight:bold;"></p> 
0
May 11 '11 at
source share

You can use the following:

 <p id="p1">Some Text here </p> #p1{ font-weight: bold; } 

OR

 <Strong><p>Some text here </p></strong> 

OR

You can use the <h1> tag , which is somewhat similar to bold

0
May 17 '11 at 11:55
source share

You can make the code as below.

 <html> <head> <style> p.boldstats{ font-weight: bold } </style> </head> <body> <p class="boldstats"> The bold finder </p> </body> </html> 
0
Dec 10 '17 at 18:42 on
source share

@ Darryl Hein's answer is correct, although one point - <b> is not recommended at all with XHTML because it is not semantic.

<strong> means semantically selected text

font-weight: bold means visually highlighted text

<strong> you can configure css to not be bold, although it was the default default. It can be made red, italics or underlined (although all these features are not very user-friendly). Use it for phrases / words in the text, not because of the visual design, but related to their meaning.

font-weight: bold should be used for bold parts related to design, such as headings, subheadings, table heading cells, etc.

-one
May 16 '11 at 9:36
source share

Use the <strong> tag because it is more semantic. <b> depreciates, so it’s best not to use it. Bold text also gives more weight to search engine optimization (SEO), so it's always better to use a real <strong> instead of making <p> or <span> bold using CSS.

-2
Mar 27 '09 at 5:34
source share



All Articles