How to set a single line break in HTML5 ?
In this article, we will add a single line break using the <br> tag. It s used to give the single line break. It is the empty tag so it does not contain end tag.
Syntax:
Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.
<br>
Example 1: This example uses <br> tag to break the line.
<!DOCTYPE html><html> <head> <title> How to defines a single line break? </title> <style> body { text-align: center; } h1 { color: green; } </style></head> <body> <h1>GeeksforGeeks</h1> <h2> HTML5: How to defines a single line break? </h2> <!-- br tag is used here --> <p> GeeksforGeeks: <br> Computer science portal </p></body> </html> |
Output:
Example 2: This example uses br class to break the line.
<!DOCTYPE html><html> <head> <title> How to defines a single line break? </title> <style type="text/css"> .br { display: block; margin-bottom: 0em; } .brsmall { display: block; margin-bottom: -.2em; } .brxsmall { display: block; margin-bottom: -.4em; } </style></head> <body> <h2>GeeksForGeeks</h2> <h2> HTML5: How to defines a single line break? </h2> <h4> This page shows different break height between </h4> <p>Hi User <span class="br"></span> Welcome to <span class="brsmall"></span> Geeks for geeks. <span class="brxsmall"></span> Hope you have enjoyed your stay. </p></body> </html> |
Output:


