我的代码如下:
<div class="abc">
<div class="bcd">
<a href="#">
<img class="img1" width="50" height="50"/>
</a>
<a>
<h3>Some Text</h3>
</a>
</div>
<div class="bcd">
<a href="#">
<img class="img1" width="50" height="50"/>
</a>
<a>
<h3>Some Text</h3>
</a>
</div>
<div class="bcd">
<a href="#">
<img class="img1" width="50" height="50"/>
</a>
<a>
<h3>Some Text</h3>
</a>
</div>
<div class="bcd">
<a href="#">
<img class="img1" width="50" height="50"/>
</a>
<a>
<h3>Some Text</h3>
</a>
</div>
</div>如何使图像响应移动设备(360X640px)和iPad(768X1024px)?你能给我CSS代码吗?
我必须给两个图片在手机和四个在iPad在一行!
发布于 2014-07-11 19:12:49
<style>
@media only screen and (max-width: 1024px) {
.abc .bcd{max-width:100%;height:auto;border:1px solid #ff0000;width:24%;display:inline-block;}
.abc .bcd a img{width:100%;height:auto;}
}
@media only screen and (max-width: 640px) {
.abc .bcd{max-width:100%;height:auto;border:1px solid #ff0000;width:48%;display:inline-block;}
.abc .bcd a img{width:100%;height:auto;}
}
</style>您可以删除边框。
如果删除边框,则一行中4行可以使用25%的宽度,一行中2行可以使用50%的宽度。
https://stackoverflow.com/questions/24695992
复制相似问题