css box model

0. 使用 box-sizing: border-box 

1. html page:<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="The_box_model.css" >
<title>Title</title>
</head>
<body>

<div class="box"></div>

</body>
</html>


2. css

html {
box-sizing: border-box;
}
*, *::before, *::after {
box-sizing: inherit;
}

.box {
width: 350px;
height: 150px;
margin: 10px;
padding: 25px;
border: 5px solid black;
}
 
posted @ 2020-05-25 12:21  pascal1000  阅读(102)  评论(0编辑  收藏  举报