How to change the height of br tag?

You can’t change the height of <br> tag as its not an HTML element, it is just an instruction which enforces a line break.
br does not take up any space in the page.

There is a way by which you can increase line break between lines, is by putting multiple br tags.

Another way is to use classed span tag and apply the style to them, to get desired output



Method-1: Use various span classes with a different style applied to them, you can change the value of “margin-bottom” for these classes to change the height of line break.

    Below is the implementation of this approach:

  • Example-1:
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html >
    <html>
      
    <head>
        <title>
          Customized break example
      </title>
      
        <style type="text/css">
            .br {
                display: block;
                margin-bottom: 0em;
            }
              
            .brmedium {
                display: block;
                margin-bottom: 1em;
            }
              
            .brlarge {
                display: block;
                margin-bottom: 2em;
            }
        </style>
    </head>
      
    <body>
      
        <h3>This page shows different 
          break height between lines</h3>
        <p> Hi User
          <span class="brlarge"></span>
          Welcome to
          <span class="brmedium"></span
          Geeks for geeks.
          <span class="br"></span
          Hope you have enjoyed your stay.
        </p>
        
    </body>
      
    </html>

    chevron_right

    
    

    Output:

  • Example-2: You can also decrease break height less than normal height by using negative bottom-margin for the span classes.
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html >
    <html>
      
    <head>
        <title>
          Customized break example
      </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>This page shows different 
          break height between</h2>
        
        <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>

    chevron_right

    
    

    Output:

  • Method-2: Use inline css in <br> tag to change the height of br tag.

  • Example-3:
    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

    <!DOCTYPE html >
    <html>
      
    <head>
        <title>
            Customized break example
        </title>
    </head>
      
    <body>
        <center>
            <h2>This page shows 
            different break 
            height between
        </h2>
      
            <p>GeeksforGeeks<br style=
            "line-height:40px"> A
              computer science portal.</p>
        </center>
    </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.