Home > Web Front-end > CSS Tutorial > How to set row height in css

How to set row height in css

王林
Release: 2021-05-14 15:16:56
Original
11420 people have browsed it

The way to set the line height in css is to use the line-height attribute, such as [line-height:70%;]. The line-height property is used to set the line height in percentage.

How to set row height in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

In css we can set the line height in percentage through the line-height attribute.

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.

  • #inherit Specifies that the value of the line-height attribute should be inherited from the parent element.

For example:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title></title> 
<style>
p.small {line-height:70%;}
p.big {line-height:200%;}
</style>
</head>

<body>
<p>
这是一个标准行高的段落。<br>
这是一个标准行高的段落。<br>
大多数浏览器的默认行高约为110%至120%。<br>
</p>

<p class="small">
这是一个更小行高的段落。<br>
这是一个更小行高的段落。<br>
这是一个更小行高的段落。<br>
这是一个更小行高的段落。<br>
</p>

<p class="big">
这是一个更大行高的段落。<br>
这是一个更大行高的段落。<br>
这是一个更大行高的段落。<br>
这是一个更大行高的段落。<br>
</p>

</body>
</html>
Copy after login

Related recommendations: css video tutorial

The above is the detailed content of How to set row height in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template