bootstrap的栅格使用问题
<div class="row">
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/1.jpg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/3.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/2.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/4.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/1.jpg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/3.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/2.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/4.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/1.jpg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/3.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/2.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/4.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/1.jpg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/3.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/2.jpeg" alt="my wallpaper1"></a></div>
<div class="col-xs-6 col-md-3 col-lg-2"><a href="photo1.html"><img class="photo_list" src="images/4.jpeg" alt="my wallpaper1"></a></div>
</div>
结果:
为什么会出现空白?
.photo_list{
width:100%;
max-height: 200px;
padding: 10px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
大概是图片有了最大的高度,所以被按比例缩放了了。
bootstrap的每一列都是有padding的,具体你可以参见如下:
具体参见如下文档:http://v3.bootcss.com/css/#grid