". The line-height attribute is used to set the distance between lines. The larger the value, the higher the line spacing."/>
". The line-height attribute is used to set the distance between lines. The larger the value, the higher the line spacing.">Home >Web Front-end >HTML Tutorial >How to set line spacing in html
In html, you can use the style attribute to add the "line-height: spacing value;" style to the paragraph element to set the line spacing, for example "
< ;/p>". The line-height attribute is used to set the distance between lines. The larger the value, the higher the line spacing.
The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.
htmlSet line spacing
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> </head> <body> <p> 这是一个标准行高的段落。<br> 这是一个标准行高的段落。<br> 大多数浏览器的默认行高约为110%至120%。<br> </p> <p style="line-height: 10px;"> 这是一个更小行高的段落。<br> 这是一个更小行高的段落。<br> 这是一个更小行高的段落。<br> 这是一个更小行高的段落。<br> </p> <p style="line-height: 2em;"> 这是一个更大行高的段落。<br> 这是一个更大行高的段落。 <br> 这是一个更大行高的段落。<br> 这是一个更大行高的段落。<br> </p> </body> </html>
Rendering:
Description:
line- The height attribute is used to set the amount of space used by rows, that is, the distance between rows.
Note: The line-height attribute does not allow negative values.
This property affects the layout of the line box. When applied to a block-level element, it defines the minimum distance between baselines in that element rather than the maximum distance.
Attribute value:
normal Default. Set reasonable line spacing.
#number Set a number, which will be multiplied by the current font size to set the line spacing.
#length Set a fixed line spacing.
% % line spacing based on the current font size.
It can be seen that the value of Line-height is set to a specific numerical value, which can be a relative value or an absolute value. In static pages, the text size is often fixed. Use absolute values, and for forums and blogs where users can customize the font size, they are usually set to relative values, so that the corresponding line spacing can be changed with the user-defined font size.
Recommended tutorials: html video tutorial, css video tutorial
The above is the detailed content of How to set line spacing in html. For more information, please follow other related articles on the PHP Chinese website!