- 盒子的类型
这里我们用到的是边框盒子,也叫怪异盒子。用box-sizing:border-box;设置。我们设置的width为边框、内边距以及内容区的宽度。 - 代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
*{
box-sizing: border-box
}
div.artical{
width: 250px;
height: 350px;
background-color:black;
margin:0 auto;
}
div.top{
width: 250px;
height: 250px;
padding: 20px;
}
div.text{
color: #ffffff;
text-align: center;
}
div#outer{
height: 100%;
border: 5px solid #cccccc;
border-radius: 50%;
padding: 20px;
}
div#inner{
height: 100%;
border: 10px solid #ffffff;
border-radius: 50%;
}
</style>
</head>
<body>
<div class="artical">
<div class="top">
<div id="outer">
<div id="inner">
</div>
</div>
</div>
<div class="text">hi!!!!</div>
</div>
</body>
</html>
- 成果展示
![当我们想让大圆圈变大时,需要减小正方形的内边距,反之则增加正方形的内边距;当我们想让小圆变大时,可以减小大圆的内边距](https://i-blog.csdnimg.cn/blog_migrate/02c5e9c3f24ba197f26474ca1f45b15b.jpeg)
当我们想让大圆圈变大时,需要减小正方形的内边距,反之则增加正方形的内边距;当我们想让小圆变大时,可以减小大圆的内边距