0

我正在尝试使用完整的 div 高度制作响应式图像。在某个时刻,宽度停止减小。

JsFiddle _

我的代码:

<html>
<head>
<style>
html,body { height:100% }
* {
margin:0;
padding: 0;
}

.teste {
height: 80%
}

.teste img {

height: 100%;
}
</style>
</head>
<body>
<div class="teste">
<img src="" />
</div>
</body>
</html>
4

1 回答 1

0

演示

 <div class="teste"> <img src="http://farm4.staticflickr.com/3782/9209525112_217d9db242_h.jpg" /></div>

CSS

html,body { height:100% }
* {margin:0;
   padding: 0;}

.teste {
height: 80%
}

.teste img {
max-height: 100%;}
于 2013-07-05T19:17:51.003 回答