We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
时间:2016-12-08 11:44:54 转自《line-height 百分比与数值的区别》
line-height: 150% 不等于 line-height: 1.5 line-height的值为百分比: 子集元素继承父级元素的距离 line-height的值为数值 : 子元素计算各自的行距离
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> body{ font-size:14px; line-height:150%; background: black; } p{ font-size:26px; background: gray; color: white; } </style> </head> <body> <p>你好!</p> </body> </html>
效果:
例子1结果
body{font-size:14px;line-height:150%;} p{font-size:26px;} //结果就是: body{line-height:21px;}//14*150%=21 p{line-heigt:21px;}//继承父元素
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> body{ font-size:14px; line-height:1.5; background: black; } p{ font-size:26px; background: gray; color: white; } </style> </head> <body> <p>你好!</p> </body> </html>
说明:
body{font-size:14px;line-height:1.5;} p{font-size:26px;} //结果就是: body{line-height:21px;} //14*1.5=21 p{line-height:39px;} //26*1.5=39
The text was updated successfully, but these errors were encountered:
You really help me! Thanks very much.
Sorry, something went wrong.
No branches or pull requests
一、结论
二、例子讲解
1. line-height 为百分比
效果:
例子1结果
2. line-height 为数值
效果:
说明:
The text was updated successfully, but these errors were encountered: