【发布时间】:2013-05-15 10:03:07
【问题描述】:
首先,我对此很陌生,已经做了很多研究,但找不到答案。
我已将页面顶部的 div 容器设置为 100% 宽度和 20% 高度。 我想插入一个可以在不同屏幕尺寸之间自动调整大小的图像。
我在这个网站上发现了一些代码,它们在 safari 和 chrome 中完美运行(在 ipad 和 iphone 上也可以完美调整大小),但在 firefox(20) 和 IE(10) 中,图像确实会稍微调整大小,但不会留在父容器中.
有人可以帮忙吗? 我一直使用的原始代码是:
<html>
<style type="text/css">
#myDiv
{
height:auto;
width:auto;
}
#myDiv img
{
max-width:100%;
max-height:100%;
margin:auto;
display:block;
}
</style>
<div id="myDiv">
<img src="images/storm.jpg">
</div>
</html>
任何帮助将不胜感激(请记住我正在学习!)
【问题讨论】:
标签: image firefox html tags image-resizing