Skip to content
Related Articles

Related Articles

Improve Article

Difference between strong and bold tag in HTML

  • Difficulty Level : Basic
  • Last Updated : 03 Dec, 2020

HTML strong tag: The strong tag is one of the element of HTML used in formatting HTML texts. It is used to show importance of the text by making it bold or highlighting it semantically.

Syntax:

<strong> Contents... </strong>

HTML bold tag: The bold tag or <b> is also one of the formatting elements of HTML. The text written under <b> tag makes the text bold presentationally to draw attention.

Syntax:

<b> Contents... </b>

The main difference between these two tag is that the strong tag semantically emphasizes on the important word or section of words while the bold tag is just offset text conventionally styled in bold. Below is the code to show this difference.



Example 1:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <style>
        body {
            text-align:center;
        }
        h1 {
            color: green;
        }
    </style>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
      
    <p><strong>
        This text is important!
    </strong></p>
      
    <p><b>This text is bold.</p>
</body>
  
</html>                  

Output:

Though there is no difference in the display of both the tags but there is semantical difference between them.

Example 2:

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title>b tag</title>
      
    <style>
        body {
            text-align:center;
        }
        h1 {
            color: green;
        }
    </style>
</head>
  
<body>
    <h1>GeeksforGeeks</h1>
      
    <p>
        Without <strong>internet</strong
        we can not use gfg
    </p>
      
    <p>
        <b>GeeksforGeeks:</b> A computer 
        science portal for geeks
    </p>
</body>
  
</html>                    

Output:

We wanted to show the importance of the word “internet” so we used <strong> tag where as for the word “GeeksforGeeks”, we just simply wanted to format the text in bold.

Supported Browser: The browser supported by <b> and <strong> tag are listed below.

  • Chrome
  • Android
  • Firefox (Gecko)
  • Firefox Mobile (Gecko)
  • Internet Explorer (IE)
  • Edge Mobile
  • Opera
  • Opera Mobile
  • Safari (WebKit)
  • Safari Mobile

Attention reader! Don’t stop learning now. Get hold of all the important Comcompetitivepetitve Programming concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :