<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
<!--如果盒子本身没有指定width/height属性,则此时padding不会撑开盒子大小-->
<style>
h1 {
height: 200px;
background-color: pink;
padding: 30px;
}
div {
width: 300px;
height: 100px;
background-color: purple;
}
div p {
border: 30px;
background-color: blue;
}
</style>
</head>
<body>
<h1></h1>
<div>
<p>吗,那你看</p>
</div>
</body>
</html>
11-07
609
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-29
2971
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)