How to break line without using <br> tag in HTML / CSS ?

Use block-level elements to break the line without using <br> tag. There are many ways to break the line without using <br> tag.
The used properties are listed below:

  • white-space: pre; It is used to make elements acts like <pre> tag.
  • display: block; It sets the display property of elements to block.

Example 1: This example uses white-space to pre to break the line.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
  
<head
    <title
        Line break withoutusing br tag
    </title
</head
  
<body style = "text-align:center;"
  
    <h1 style = "color:green;"
        GeeksForGeeks 
    </h1
      
    <div style="white-space: pre">
        GeeksforGeeks
        GeeksforGeeks
    </div>
</body
  
</html>                    

chevron_right


Output:



Example 2: This example uses display property to break the line.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html> 
<html
  
<head
    <title
        Line break using display property
    </title
   
    <style>
        p span {
            display: block;
        }
    </style>
</head>
  
<body style = "text-align:center;"
  
    <h1 style = "color:green;"
        GeeksForGeeks 
    </h1
          
    <p>
        <span>GeeksforGeeks_1</span>
        <span>GeeksforGeeks_2</span>
    </p>
</body
  
</html>                    

chevron_right


Output:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.