html

How to Insert Blank Line in HTML

Blank lines increase readability by separating logically related pieces of code. The following situations require the usage of two blank lines. The first one is inside source file segments, and the second is between the definitions of classes and interfaces.

This article will teach us about inserting a blank line in HTML with different methods.

How to Insert Blank Line in HTML?

There are different methods utilized for adding blank lines in HTML. Some of them are listed below:

Let’s get started with inserting blank lines with different methods!

Method 1: Insert Blank Line Using “<hr>” Tag

To insert a blank line in HTML, the “<hr>” tag can be utilized for this purpose. For practical implication, try out the stated instructions.

Step 1: Make a div Container

Initially, design a div container using the “<div>” tag and insert an id or class attribute with a particular name according to your preference.

Step 2: Insert Heading

Next, utilize the HTML heading tag for inserting a heading in the HTML page. To do so, the <h1> heading tag is used in this case.

Step 3: Add Blank Line

After that, insert a blank line with the help of the “<hr>” element which is utilized for adding a blank line in HTML:

<div class="blank-line">
 <h1>Blank Line</h1>
 <hr>
</div>

 
It can be observed that the blank line has been added successfully:

Method 2: Insert Blank Line Using “<br>” Tag

To insert or add a blank line in HTML, the “<br>” tag can also be used for this purpose. To do so, try out the stated instructions:

    • Add a div container with the help of the “<div>” element.
    • Add a heading with the help of the <h1> tag.
    • Embed data on the HTML page.
    • Then, utilize the “<br>” element for inserting blank space:

 

<div class="blank-line">
 <h1>Blank Line</h1>
  This is Linuxhint Tutorial Website.<br><br>
  They provide the best content on different computer science categories.
</div>

 
Output

Method 3: Insert Blank Line Using “<pre>” Tag

User can also insert a blank line by utilizing the “<pre>” tag. To do so, create a div and embed data in the div element. After that, utilize the “<pre>” element. The “<pre>” tag defines preformatted text. Text in an “<pre>” element is displayed in a fixed-width font, and the text preserves both spaces and line breaks:

<div class="blank-line">
 <h1>Blank Line</h1>
  <pre>This is Linuxhint,
  Tutorial Website</pre>
</div>

 
Output


That’s all about inserting the blank line in HTML.

Conclusion

To insert a blank line in HTML, the user can utilize the various elements, including the “<hr>”, “<br>”, and “<pre>” tags. To do so, create a div container and utilize the tag after embedding the data inside the HTML page. This post has stated the method for inserting the blank line in HTML with different methods.

About the author

Hafsa Javed