【发布时间】:2013-06-01 13:10:36
【问题描述】:
img {
max-width: 100% !important; /* Set a maxium relative to the parent */
width: auto\9 !important; /* IE7-8 need help adjusting responsive images */
height: auto; /* Scale the height according to the width, otherwise you get stretching */
vertical-align: middle;
border: 0;
display: block;
-ms-interpolation-mode: bicubic;
}
上面的 CSS 取自 Twitter Bootstrap,它允许响应式图像。唯一的问题是这在 Firefox 和 IE 中无效。
以下情况:
<div class="row-fluid">
<div id="logo" class="span4">
<a href="<?= home_url( '/' ) ?>"><img src="<?= get_template_directory_uri() ?>/assets/images/logo.png" /></a>
</div>
</div>
http://dev.netcoding.net/lowsglass/about-us/ - 这是一个显示问题的页面。
在 Firefox 或 IE 中,将页面缩小到 432 像素以下,您会看到图像不再遵循最大宽度(而在 764 像素以上时它们会这样做)。
如何在不使用图像容器的情况下解决此问题,以使响应式图像在 Firefox 和 IE 中工作?
【问题讨论】:
-
听起来像 Bootstrap 的响应位可能会给您带来一些问题。您确定没有媒体查询干扰吗?
-
我很肯定这不是媒体查询。除了
responsive.css和@media print之外,img标签没有应用任何样式。 -
嘿,你找到答案了吗?
标签: html image responsive-design css