| by Arround The Web | No comments

HTML br Tag

The HTML br tag is used for introducing a line break. This tag can be used as many times in an HTML script as a developer wishes to depend upon the requirements of the web page that they wish to create. In this article, we will learn the usage of the HTML br tag.

Significance of the br Tag in HTML

We have already stated that the br tag in HTML is used for introducing a line break. Its significance can be realized from the fact that whenever you wish to create some text that spans multiple lines, several sentences are supposed to be displayed independently. Otherwise, they are not able to convey their proper meaning. In HTML, you can quickly achieve this goal by using the br tag.

Usage of the br Tag in HTML

For using the br tag in HTML, you must go through the following three examples. These examples have been designed from a very basic difficulty level to a relatively complex difficulty level so that the learning curve of this tutorial can perfectly match the information grasping capabilities of the readers.

Example # 1: Simple Usage of the br Tag

In this example, we will show you how the br tag in HTML works by inserting it at different points of a random sentence. The HTML script for serving this purpose is shown below:

In this example, we just wanted to break the sentence “The HTML br element is used to break the current line and insert a new line” into multiple random chunks. For that, we have used this tag three times within this sentence. Moreover, we have enclosed this sentence within the paragraph tag of HTML.

The web page corresponding to this HTML script is shown in the following image. You can see how we have managed to break down a sentence into multiple lines by using the br tag of HTML.

Example # 2: Usage of the br Tag in a Poem

Now, we will be using the br tag of HTML for displaying the poem’s different phrases in different lines. For that, we will be using the HTML script shown in the image below:

You can see that we have written the whole poem in a single line in our HTML script. However, we have used the br tags wherever needed to display the poem’s phrases in different lines.

The poem that we have used in the HTML script is displayed in a nice format on the following web page:

Now, we will remove this br tag from the very same script to see how our poem will look like without this tag, as shown in the following image:

After removing the br tags from our poem, it appeared on a single line on our web page and looked very untidy, as shown in the following image. This highlights the importance of the br tag in HTML.

Example # 3: Usage of the br Tag in an Address

In our last example, we will be using the br tag in HTML for displaying the different components of an address in different lines. For that, the HTML script is provided below:

In this script, we simply used the paragraph tag for enclosing a random address. Then, with the help of five br tags, we have separated the different components of this address, i.e., the house number, street number, name of the road, name of the town, name of the state, and the name of the country.

The specified address in this HTML script is shown on the web page in the following image:

Conclusion

This article provided you with a thorough explanation of the importance of the br tag in HTML. We began by highlighting the significance of this HTML element, followed by some useful examples from which you can get help. After going through these examples, you will get a rough idea of the scenarios where you can incorporate the br tag in your HTML scripts. By doing so, you will be able to make your web page look more readable.

Share Button

Source: linuxhint.com

Leave a Reply