扫码关注官方订阅号
Document dsflfij
dsflfij
p的高度变得很高
认证高级PHP讲师
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> html { font-size: 100px; } span { font-size: 12px; line-height: 12; } </style> </head> <body> <p> <span>dsflfij</span>1 </p> </body> </html>
因为font-size可继承,你这样写了后p的font-size也变大了。
并且需要注意的一点line-height里面 12 != 12px,详情百度一下差异
font-size是可继承的属性,你这样写之后p就继承了html 的font-size:100px的属性,所以p的font-size也变大了,由于你设置了span的font-size,所以就感觉p变得很高。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
因为font-size可继承,你这样写了后p的font-size也变大了。
并且需要注意的一点line-height里面 12 != 12px,详情百度一下差异
font-size是可继承的属性,你这样写之后p就继承了html 的font-size:100px的属性,所以p的font-size也变大了,由于你设置了span的font-size,所以就感觉p变得很高。