1
我需要动态调整div的高度以显示其背景图像。我试图让这个工作,所以我可以做的CSS转换技巧,你把鼠标放在一个div和背景放大,但我的图像将有不同的大小。任何帮助表示赞赏...我卡住了!根据背景图像尺寸div
CSS:
<style>
.dynaimage{
width:80%;
background-image:url('variable-image');
background-size:100%; margin:0 auto;
}
</style>
HTML:
<div class="dynaimage"></div>
<p>The above div should take the height of its background image</p>
这比结我的大脑周围捆绑的方式更容易!日Thnx! –