What is the alternative to
if I want to control the height between lines?

后端 未结 6 634
难免孤独
难免孤独 2020-12-10 01:15

In following example:

Line1 
Line2

I\'m using
to force Line2 to go to next line, but as far as I know

相关标签:
6条回答
  • 2020-12-10 01:50

    Using CSS you can control the line-height property of any element.

    someElement {
        line-height:12px;
    }
    

    Now you may simply set this for an element, or use it on the entire HTML to provide uniformity across the document. This is safe, cross-browser compatible and easy to use.

    0 讨论(0)
  • 2020-12-10 01:51

    Normally, using <br /> is old way of breaking a line. You should use <p>, <div> or some block level elements and give them top or bottom margins.

    p {
       margin-top:5px;
       margin-bottom:5px
    }
    
    0 讨论(0)
  • 2020-12-10 01:53
    1. I add a <div>, best way for me, with CSS margin. Or,
    2. The <p> tag.
    0 讨论(0)
  • 2020-12-10 02:06

    Use differents blocks :

    <p>Line1</p>
    <p>Line2</p>
    
    0 讨论(0)
  • 2020-12-10 02:06

    Use padding & / or margin css attributes.

    0 讨论(0)
  • 2020-12-10 02:11

    You can use css line-height property along with <br/> tag to control spacing between lines.

    <style>
    .small
    {
        line-height:100px;
    }
    </style>
    
    <p class="small">
    This is a paragraph with a smaller line-height.<br />
    This is a paragraph with a smaller line-height.<br />
    This is a paragraph with a smaller line-height.<br />
    This is a paragraph with a smaller line-height.<br />
    </p>
    
    0 讨论(0)
提交回复
热议问题