在UIWebView中调整图像大小以查看视口大小 [英] Resize images in UIWebView to viewport size

查看:90
本文介绍了在UIWebView中调整图像大小以查看视口大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone App中的UIWebView中显示带有一些图像的HTML。
当图像宽于iPhone的视口时,我得到了水平卷轴,我不想要它,因为它主要是关于文本而不是图像。

I'm displaying HTML with some images inside a UIWebView in my iPhone App. When the images are wider than the viewport of the iPhone I get horizontal scrollers which I don't want because its mostly about the text not the images.

有没有办法根据宽度调整UIWebView内显示的图像(最好:即使设备被旋转)?

Is there a way to resize images displayed inside the UIWebView according to the width (best: even if the device is rotated)?

推荐答案

如果希望最大宽度为webView的宽度,请使用max-width CSS属性。

If you want the maximum width to be the width of the webView, use the max-width CSS property.


max-width:100%;宽度:自动; height:auto;

max-width: 100%; width: auto; height: auto;

这篇关于在UIWebView中调整图像大小以查看视口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆