Open In App

How to set a single line break in HTML5 ?

Last Updated : 03 Jun, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
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:
<br>
Example 1: This example uses <br> tag to break the line. html
<!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. html
<!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:

Next Article

Similar Reads