How To Break a Line Without Using br Tag In Html and Css

admin_img Posted By Bajarangi soft , Posted On 09-10-2020

Use block-level elements to break the line without using <br> tag. There are many ways to break the line without using <br> tag.

Br tag In Html

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:#ec8211;" >
BAJARANGI SOFT
</h1>

<div style="white-space: pre">
  Bajarangi soft
    Bajarangi soft
</div>
</body>

</html>
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:#f80d0d;" >
BAJARANGI SOFT
</h1>

<p>
    <span>bajarangi soft_1</span>
    <span>bajarangi soft_2</span>
</p>
</body>

Related Post