Home >Web Front-end >CSS Tutorial >How to set empty lines in css
margin-top
and line-height
properties.
<p>Detailed description:
<p>1. Use the margin-top
<p>margin-top
attribute. Sets the top margin for the element. By increasing the top margin, you create a white space above an element. The syntax is as follows:
<code class="css">element { margin-top: value; }</code><p>Among them,
value
The value can specify pixels (px), percentage (%) or other units.
<p>2. Use the line-height
<p>line-height
attribute to specify the vertical space between lines in an element. By increasing the value of line-height
, you can create white space between lines. The syntax is as follows:
<code class="css">element { line-height: value; }</code><p> Among them,
value
value can specify multiples (em) or other units.
<p>Example:
<p>The following CSS code will set a top margin of 20px and a wrap height of 1.5x for the <p>
element:
<code class="css">p { margin-top: 20px; line-height: 1.5; }</code><p>Note:
margin-top
and line-height
at the same time to control empty lines more accurately the height of. padding-top
attribute instead of margin-top
. The above is the detailed content of How to set empty lines in css. For more information, please follow other related articles on the PHP Chinese website!