这个小提琴适用于 Firefox,但不适用于 chrome。此图像未保持纵横比:
<body style="height:100%;margin:0">
<div id="dvMain" style="width:100%;height:200px;border:1px dashed gray;text-align:center">
<img id="imgMain " src="http://lorempixel.com/output/fashion-q-c-987-804-9.jpg" style="display:inline-block;height:auto !important;width:auto;max-height:100% " />
</div>
<span onclick="rez();">Click me</span>
function rez(){
$("#dvMain").css("height", "50px");
}
但是,如果我去检查员并刷新高度属性(取消选中/选中)它可以工作......