【发布时间】:2021-01-28 12:04:55
【问题描述】:
html {
box-sizing: border-box;
}
*,
*::before,
*::after {
box-sizing: inherit;
}
.box {
height: 100px;
width: 500px;
padding: 20px;
border: 40px solid black;
background-color: blue;
}
<div class="box">
With border-box - with padding & border
</div>
带边框 - 带内边距和边框
为什么在上面的示例中只从顶部和左侧应用填充?
【问题讨论】:
-
将 overflow:auto 添加到您的元素中,您就会明白。 Thep add is there 但溢出了