html根字体设置成很大的值后, 包裹了行内元素的div莫名变高是什么原因?
小白
小白 2017-03-07 09:28:14
0
2
1316
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>

    <style>
    html {
        font-size: 100px;
    }
    span {
        font-size: 12px;
        line-height: 12;
    }
    </style>
</head>
<body>
    <div>
    <span>dsflfij</span>
    </div>
</body>
</html>


小白
小白

好好学习,天天向上!!!

reply all(2)
数据分析师

After setting the html root font to a very large value, why does the div that wraps the inline elements become inexplicably taller? -PHP Chinese website Q&A-After setting the HTML root font to a very large value, why does the div that wraps the inline elements become inexplicably taller? -PHP Chinese website Q&A

Let’s take a look and learn.

迷茫
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>

    <style>
    html {
        font-size: 100px;
    }
    span {
        font-size: 12px;
        line-height: 12;
    }
    </style>
</head>
<body>
    <div>
    <span>dsflfij</span>1
    </div>
</body>
</html>

因为font-size可继承,你这样写了后div的font-size也变大了。

并且需要注意的一点line-height里面 12 != 12px,详情百度一下差异

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template