question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Webview font size is auto adjusting as system font size

See original GitHub issue

I wrote a simple webpage. This page only contains marquee element.

<style>
  #text {
      padding: 0;
      font-size: 65vh;
  }
</style>
<marquee behavior="scroll" scrollamount="50" id="text">hello world</marquee>

And I wraped this page as a webview in React Native.

export default function App() {
  return (
    <WebView 
      source={{ uri: `https://marquee-page-url.com`}}
    />
  );
}

It works like the below image. It works perfectly. KakaoTalk_Photo_2021-12-28-23-30-33 002

But if I change system (Android’s) font size, than it works wrong. The font is too big. KakaoTalk_Photo_2021-12-28-23-30-33 001

I’m suspecting that system font size is effecting webview’s font size. I want webview’s font size to be fixed. How to do this?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
TheAlmightyBobcommented, Jan 7, 2022

Have you tried textZoom?

1reaction
echagnascommented, Jun 14, 2022

Hi, just tested, but works only on Android… not iOS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Android WebView scaled font size - Stack Overflow
The size is defined in a dimens resource, so my fontSize variable on an xhdpi device comes in as 36, which is not...
Read more >
The font size and line width in Webview is different ... - MSDN
I manage to display the website in mobile phone using webview however the font size and line width in webview is bigger than...
Read more >
text-size-adjust - CSS: Cascading Style Sheets - MDN Web Docs
The text-size-adjust property is specified as none , auto , or a <percentage> . Values. none. Disables the browser's inflation algorithm. auto.
Read more >
How do I increase the font size of content in WebView? - Quora
This is what I use when I want to enable the user to change the text size / zoom in a [code ]WebView[/code]:...
Read more >
Android Question Webview font size scaling with system ... - B4X
When i open my server website page in a browser then all font size on buttons fit correct. When i open the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found