<!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 type="text/css">
div {
width: 100px;
height: 100px;
background-color: pink;
}
.box1 {
border-style: solid;
border-width: 10px;
}
.box2 {
border-style: dashed;
border-color: aqua;
}
.box3 {
border-style: dotted;
border-top: solid;
}
</style>
</head>
<body>
<p>边框样式——实线+粗细</p>
<div class="box1"></div>
<p>边框样式——虚线+边框样式</p>
<div class="box2"></div>
<p>边框样式——点线</p>
<div class="box3"></div>
</body>
</html>
效果图:
从效果图可以看出边框会影响我们的盒子实际大小。
内边距案列展示
<!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 type="text/css">
div {
width: 100px;
height: 50px;
background-color: rgb(183, 133, 142);
}
.box1 {
padding: 10px;
}
.box2 {
margin-top: 10px;
padding: 10px 20px;
}
.box3 {
margin-top: 10px;
padding: 0px 10px 5px;
}
.box4 {
margin-top: 10px;
padding: 5px 15px 10px 20px;
}
</style>
</head>
<body>
<div class="box1">
<p>内边距设置一个值</p>
</div>
<div class="box2">
<p>内边距设置2个值</p>
</div>
<div class="box3">
<p>内边距设置3个值</p>
</div>
<div class="box4">
<p>内边距设置4个值</p>
</div>
</body>
</html>
效果图:
我们不难发现padding确实对我们的盒子实际大小有所影响。