<" /> <" /> <"/>

Making webView text right size but also preserve <img> size?

37 Views Asked by At

I'm loading WKWebView (iOS) inside my app and adding some tags to make loaded string looks normally. Here is an example

htmlString = "<!DOCTYPE html><html><meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'><body style=\"margin:0; text-size-adjust: 100%; font-family: Arial; font-size: 12px;!important\">" + (self.marker?.storeAccess ?? "") + "</body></html>"

where self.marker?.storeAccess are my data.

I read at many forums that this line initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0 will make my text "normal-sized", because originally it was too small to even read. And that's good, it works. But it also causing <img> to overflow my webView and become cut in right-half. I wonder if there is a way to satisfy both text-size and img-width ?

I tried stuffs like

img {
    max-width: 100%;
    height: auto;
  }

and it didn't work.

0

There are 0 best solutions below