盒模型自动内减

啊css模型自动内减

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .one {
            width: 200px;
            height: 200px;
            background-color: blue;
            border: 10px solid pink;
            padding: 50px;
        }
        
        .two {
            width: 200px;
            height: 200px;
            box-sizing: border-box;
            background-color: blue;
            border: 10px solid pink;
            padding: 50px;
        }
    </style>
</head>

<body>
    <!-- 无自动内减 -->
    <div class="one"></div>
    <!-- 自动内减 -->
    <div class="two"></div>

</body>

</html>

效果图:

盒模型自动内减

上一篇:外边距合并-相邻块元素垂直外边距


下一篇:前端基础之轮播图以及BFC规范以及IFC规范