Pro*_*kie 3 css padding percentage
这是我的示例代码:
body {
margin: 0;
padding: 0;
border: 0;
background: #444;
}
#container {
width: 25px;
margin: auto;
margin-top: 2px;
padding-top: 1%;
border-bottom: 3px solid #58e;
background: #fff;
}
Run Code Online (Sandbox Code Playgroud)
<div id="#container">text</div>
Run Code Online (Sandbox Code Playgroud)
当我在chrome中运行它并检查元素div的计算样式时,宽度将如上所定义为25px,但填充顶部为13.65px.
我知道填充顶部是根据元素宽度的百分比计算的.所以它应该是25px或2.5px的1%.
它为什么会以13.65像素的价格出现?