我有一个像下面这样的列表,在 Firefox 中,图像实际上是随着浏览器宽度一起缩放的,但是在 Chrome 中,当我调整图像大小时,它们的大小保持不变,并且这些<li>
部分只填充了空白。看看我在这里的意思
html
<ul>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
<li><img src="http://distilleryimage8.s3.amazonaws.com/23ddf3860e2911e29c2d22000a1e9e7e_6.jpg"></li>
</ul>
css
li img{
display: block;
height: auto;
width: 100%;
float: left;
}
@media screen and (min-width: 307px) and (max-width: 440px) {
li{
float:left;
width: 50%;
height: auto;
display: inline-block;
}
}
@media screen and (min-width: 440px) and (max-width: 480px) {
li{
float:left;
width: 50%;
height: auto;
display: inline-block;
}
}
@media screen and (min-width: 480px) and (max-width: 612px) {
li{
float:left;
width: 50%;
height: auto;
display: inline-block;
}
}
@media screen and (min-width: 612px) and (max-width: 767px) {
li{
float:left;
width: 33.3333%;
height: auto;
display: inline-block;
}
}
@media screen and (min-width: 768px) and (max-width: 901px){
li{
float:left;
width: 33.3333%;
height: auto;
display: inline-block;
}
}
@media screen and (min-width: 901px) and (max-width: 1024px) {
li{
float:left;
width: 25%;
height: auto;
display: inline-block;
}
}
/* Desktops and laptops ----------- */
@media only screen and (min-width : 1024px) and (max-width: 1079px){
li{
float:left;
width: 20%;
height: auto;
display: inline-block;
}
}
@media only screen and (min-width : 1079px) and (max-width: 1224px) {
li{
float:left;
width: 20%;
height: auto;
display: inline-block;
}
}
@media only screen and (min-width : 1224px) and (max-width: 1530px) {
li{
float:left;
width: 20%;
height: auto;
display: inline-block;
}
}
/* Large screens ----------- */
@media only screen and (min-width: 1530px) and (max-width : 1824px) {
li{
float:left;
width: 16.6666%;
height: auto;
display: inline-block;
}
}
/* Large screens ----------- */
@media only screen and (min-width : 1824px) {
li{
float:left;
width: 11.1111%;
height: auto;
display: inline-block;
}
}