我正在使用 transform
根据图像的 EXIF 数据旋转图像。然后,我想通过将其适应其父级 div 来“全屏”显示它。
问题在于,max-width
/ max-height
和所有其他尺寸指令“忽略”旋转(这是正常的,根据 transform
规范,元素的变换在流中是“被忽略”的)。
Jsfiddle:http://jsfiddle.net/puddjm4y/2/
div.top {
position: fixed;
width: 100%;
height: 100%;
border: 1px solid blue;
}
img {
transform: rotate(90deg);
max-width: 100%;
max-height: 100%;
}
<div class="top">
<img src="http://www.androidpolice.com/wp-content/uploads/2014/02/nexusae0_wm_DSC02232.jpg">
</div>
有没有一种方法可以实现这个?