Skip to content
Related Articles

Related Articles

How to break line without using <br> tag in HTML / CSS ?
  • Last Updated : 15 Feb, 2019

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.




<!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>                    

Output:

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




<!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>                    

Output:




My Personal Notes arrow_drop_up
Recommended Articles
Page :