将 UIWebView 中的图像调整为视口大小 [英] Resize images in UIWebView to viewport size

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

问题描述

我在我的 iPhone 应用程序的 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.

最大宽度:100%;宽度:自动;高度:自动;

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

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

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