HTML <br> Tag

Tag br is the topic of this post, with the expectation that it will meet the educational requirements.

The HTML <br> tag is a self-closing tag that stands for “line break”. It is used to insert a single line break or a vertical space between text or elements within a web page.

Unlike most other HTML tags, the <br> tag doesn’t require a closing tag, as it doesn’t wrap any content. Instead, it is used to break up text or content and create a new line or space without adding any additional formatting.

Here’s how to add single-line breaks:

Example: 

<!DOCTYPE html> <html> <body> <p>This is<br> line breaks<br> in a paragraph text,<br> apply the br <br> tag.</p> </body></html>

When writing a poem, use <br>:

Example: 

<!DOCTYPE html> <html> <body> <p>April is the cruellest month, breeding<br> Lilacs out of the dead land, mixing<br> Memory and desire, stirring,<br> Dull roots with spring rain..</p> <p><em>-T. S. Eliot</em></p> </body></html>

Lets see the example of the ping command with the <br> and <pre> tag:

Example: 

<!DOCTYPE html> <html> <body> <pre> Command: ping 8.8.8.8 Reply from 8.8.8.8: bytes=32 time=15ms TTL=52<br> Reply from 8.8.8.8: bytes=32 time=14ms TTL=52<br> Reply from 8.8.8.8: bytes=32 time=15ms TTL=52<br> Reply from 8.8.8.8: bytes=32 time=15ms TTL=52<br> Ping statistics for 8.8.8.8:<br> Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),<br> Approximate round trip times in milli-seconds:<br> Minimum = 14ms, Maximum = 15ms, Average = 14ms </pre> </body> </html>


Uses and Definition

Using the Tag br <br> causes a single line break.

The <br> tag is an effective tool for writing poems or addressing people.

The <br> tag is empty, which means it doesn’t have an end tag.

Advice: Put the Tag <br> tag to insert line breaks, not to create space within paragraphs.

Browser Compatibility

Element
<br>YesYesYesYesYes

Global Attributes

The <br> tag also endorses HTML’s Global Attributes.


Event Attributes

The <br> tag also accepts HTML Event Attributes.


Use of HTML <br> Tag

Here are some common use cases for the <br> tag:

  • The <br> tag can be used to break up text within a paragraph and create a new line. This is often used to create a list of items, with each item on a separate line.
  • The <br> tag can also be used to create vertical spacing between different elements on a web page. For example, it can be used to add space between an image and a paragraph of text.
  • In some cases, the <br> tag may be used within the HTML code itself to add line breaks or formatting to the code. This can make the code easier to read and understand.
If this article was helpful enough to meet your educational needs, do share this article with your friends by clicking on the links below.

We value your feedback.
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0
+1
0

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!
icon

Leave a Reply

Your email address will not be published. Required fields are marked *