The <b> tag in HTML is used to make the enclosed text bold, giving it greater emphasis or visual importance.
- Unlike the <strong> tag, which also makes text bold but with semantic importance.
- The <b> tag is purely for styling purposes and does not carry semantic meaning.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bold Text Example</title>
</head>
<body>
<p>This is a <b>bold</b> word in this sentence.</p>
</body>
</html>
Note: Alternatively, we can use the CSS font-weight property to bold text.
Using CSS font-weight Property
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSS Bold Text Example</title>
</head>
<body>
<p style="font-weight: bold">This is bold text using CSS</p>
</body>
</html>