嗨,我正在尝试使这个 UL 以 1024x768 分辨率响应。
这是列表:
<ul class="beforeafterpics">
<li><img class="ba-bg" src="IMAGEHERE" width="220px" height="264px" alt="tummy tuck before and after pictures"></li>
<li><img class="ba-bg" src="IMAGEHERE" width="220px" height="264px" alt="tummy tuck before and after pictures"></li>
<li><img class="ba-bg" src="IMAGEHERE" width="220px" height="264px" alt="tummy tuck before and after pictures"></li>
<li><img class="ba-bg" src="IMAGEHERE" width="220px" height="264px" alt="tummy tuck before and after pictures"></li>
</ul>
这是原始的 CSS:
.beforeafterpics {
text-align: center;
}
.beforeafterpics li{
display: inline-block;
list-style-type: none;
}
.ba-bg {background-color: #FFFFFF;
border: 1px solid rgba(0, 0, 0, 0.2);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
padding: 4px;
}
这是媒体查询:
<style type="text/css">
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
{
.ba-bg {
width: 50%;
}
}
</style>
当浏览器的分辨率为 1024x768 时,我希望图片分为两列而不是四列。
--- 得到它的工作!感谢您的回复!