我有以下标记:
.myclass {
display: flex;
flex-wrap: wrap;
}
.myclass img {
width: 100%;
display: block;
height: auto;
}
<link href="//cdn.jsdelivr.net/bootswatch/3.3.5/paper/bootstrap.css" rel="stylesheet" />
<div class="main col-md-12 col-sm-12">
<div class="container-fluid">
<div class="row myclass">
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label -3</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label -2</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label -1</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 0</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 1</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 2</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 3</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 4</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 5</h4>
</a>
</div>
</div>
</div>
</div>
</div>
据您所知,它是3x3 Bootstrap网格。但它表现得非常苛刻:在我的Firefox中,我只能使用 .myclass 来解决所有问题。 但是没有这一行,我有3个正确的列,而不是2个清晰的列,然后每行有1列。有了这一行,我在Chrome中遇到了错误:有2个正确的列和清晰的位置而不是第三列。我该如何解决这个问题?
答案 0 :(得分:0)
在bootstrap中,您不应该使用宽度大于12的列溢出一行。这意味着您要在布局中构建的每一行应该在单独的<div class="row"></div>
中。检查下面的代码段是否可以解决您的问题。
.myclass img {
width: 100%;
display: block;
height: auto;
}
<link href="//cdn.jsdelivr.net/bootswatch/3.3.5/paper/bootstrap.css" rel="stylesheet" />
<div class="main col-md-12 col-sm-12">
<div class="container-fluid">
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label -3</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label -2</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label -1</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 0</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 1</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 2</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 3</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 4</h4>
</a>
</div>
</div>
<div class="col-xs-12 col-sm-6 col-md-4">
<div class="text-center well">
<a href="#">
<img src="#" />
<h4 class="for_bubles">My label 5</h4>
</a>
</div>
</div>
</div>
</div>