<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
body,a,p{
margin: 0;padding: 0;
}
.box{
max-width: 1100px;
min-width: 830px;
height: 320px;
margin: auto;
display: -webkit-flex;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-content: space-between;
}
.box a{
display: block;width: 200px;height: 150px;border-radius: 10px;overflow: hidden;text-decoration: none;
box-shadow: 0 0 3px;
}
.box a img{
width: 200px;height: 120px;
}
.box a p{
width: 200px;height: 30px;line-height: 30px;font-weight: 400;
text-align: center;color: black;
}
</style>
</head>
<body>
<div class="box">
<a href="#">
<img src="img/1.jpg" >
<p>我要自学网1</p>
</a>
<a href="#">
<img src="img/2.jpg" >
<p>我要自学网2</p>
</a>
<a href="#">
<img src="img/3.jpg" >
<p>我要自学网3</p>
</a>
<a href="#">
<img src="img/4.jpg" >
<p>我要自学网4</p>
</a>
<a href="#">
<img src="img/5.jpg" >
<p>我要自学网5</p>
</a>
<a href="#">
<img src="img/6.jpg" >
<p>我要自学网6</p>
</a>
<a href="#">
<img src="img/7.jpg" >
<p>我要自学网7</p>
</a>
<a href="#">
<img src="img/8.jpg" >
<p>我要自学网8</p>
</a>
<a href="#">
<img src="img/9.jpg" >
<p>我要自学网9</p>
</a>
<a href="#">
<img src="img/10.jpg" >
<p>我要自学网10</p>
</a>
</div>
</body>
</html>


flex wrap 就是这样的,我提供你一种解决方案
b站的视频自动调整就是用的这种方法,我也是刚学前端一个星期,照着b站做了一个模仿界面,b站源码是这样解决的
1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
body,a,p{
margin: 0;padding: 0;
}
.box{
max-width: 1100px;
min-width: 830px;
height: 320px;
margin: auto;
display: -webkit-flex;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: space-between;
}
.box a{
display: block;width: 200px;height: 150px;border-radius: 10px;overflow: hidden;text-decoration: none;
box-shadow: 0 0 3px;
}
.box a img{
width: 200px;height: 120px;
}
.box a p{
width: 200px;height: 30px;line-height: 30px;font-weight: 400;
text-align: center;color: black;
}
@media screen and (max-width: 1000px){
.box a:nth-child(n+9){
display: none;
}
}
</style>
</head>
<body>
<div class="box">
<a href="#">
<img src="vuex.png" >
<p>我要自学网1</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网2</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网3</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网4</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网5</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网6</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网7</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网8</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网9</p>
</a>
<a href="#">
<img src="vuex.png" >
<p>我要自学网10</p>
</a>
</div>
</body>
</html>


位置不够,跑出来不是正常的吗?
justify-content: space-between;这个是左右对齐
要么就给box加个固定宽度,如.box{width:1100px}