在Android 4.0.4,股票浏览器上,我无法设置图像的最大高度。目前它在容器外面呈现。
HTML
<div class="dualBlock">
<div class="dualImage col-postImage">
<img src="http://placekitten.com/300/600" />
</div>
</div>
CSS
.dualBlock {
width:80%;
margin:50px auto;
}
div.dualImage {
max-height:300px;
width:100%;
position:relative;
text-align:center;
background-color:red;
}
div.dualImage img {
max-width:100%;
max-height:100%;
}
小提琴 http://jsfiddle.net/SEOplay/QkEtq/1/
这在Chrome中工作正常并按预期呈现,问题只发生在Android股票浏览器上。
如果我为.dualImage
定义一个高度,比如说300px可以正常工作。为什么Android只接受定义的高度,如何在其库存浏览器上使用它?
答案 0 :(得分:6)
这样做:
div.dualImage img {
max-height: 300px;
max-width: 100%;
}