1. <br>:
The <br>
tag is used to insert a line break within text. It doesn’t require a closing tag because it’s an empty element. It’s often used to break lines in addresses, poems, or to create space between elements without starting a new paragraph.
Syntax:
This is a line<br>break example.
2. <hr>:
The <hr>
tag is used to create a horizontal line, often referred to as a “horizontal rule” or divider. Like the <br>
tag, it’s also an empty element and doesn’t require a closing tag. It’s commonly used to separate content sections or to delineate changes in topic or theme.
Syntax:
<p>This is some text.</p>
<hr>
<p>This is more text.</p>
3. <b>:
The <b>
tag is used to apply bold formatting to text. However, it’s considered a presentational tag, and its use is discouraged in favor of CSS for styling purposes. The <strong>
tag is preferred for indicating importance or emphasis semantically.
Syntax:
<p>This is <b>bold</b> text.</p>
4. <i>:
The <i>
tag is used to apply italic formatting to text. Similar to the <b>
tag, it’s also considered a presentational tag, and its use is discouraged in favor of CSS for styling purposes.
Syntax:
<p>This is <i>italic</i> text.</p>
5. <s>:
The <s>
tag is used to represent strikethrough text. It’s typically used to indicate that a piece of text has been deleted or is no longer relevant. However, like <b>
and <i>
, it’s a presentational tag, and its use is discouraged in favor of CSS.
Syntax:
<p>This text is <s>strikethrough</s>.</p>
6. <u>:
The <u>
tag is indeed used for underlining text in HTML. It is a formatting tag that specifies text should be underlined.
Syntax:
<p>This text is <u>underlined</u>.</p>
Example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Html tags</title>
</head>
<body>
<p>This is a line<br>break example.</p>
<hr>
<p>This is <b>bold</b> text.</p>
<p>This is <i>italic</i> text.</p>
<p>This text is <s>strikethrough</s>.</p>
<p>This text is <u>underlined</u>.</p>
</body>
</html>