Home  >  Q&A  >  body text

css - 手机app中rem的基准值计算错误

1.使用html的font-size,然后通过rem设置图片高度 对页面图片的高度进行自适应,在多个手机浏览器和app内测试都没问题,但在华为荣耀i7手机的app中打开宽度会小于于屏幕宽度。
但是通过设置宽度为100%时,则不会出现这个问题;
为了适应华为荣耀i7的app,宽度都改成了百分比,但是这不是一个很好的办法,希望大家能帮我解决一下这个问题

天蓬老师天蓬老师2766 days ago778

reply all(2)I'll reply

  • ringa_lee

    ringa_lee2017-04-17 11:55:05

    Isn’t your rem relative to html? ? How do you set the body? Not to mention the html or the body. Huawei mobile phones do have a lot of particularities. Most of them can be solved through an attribute value in the meta tag. I forgot what it is specifically. You can check it. Check, similar to

    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

    You are checking what else you need to write about Huawei mobile phones. You have written them all. Try it now

    Also, rem is generally the font-size of HTML

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 11:55:05

    Thank you for the invitation. In the app? Webview of your own application? I have encountered this kind of compatibility pitfall before. At that time, the page height was wrong on some mobile phones. . Later, I had no choice and couldn't afford it, so I changed my plan. Until Android they upgraded the application and changed the webview.

    This calculation is not accurate. It may not only be Huawei phones, but also Meizu phones! Take a look. . .

    Downgrade the css and judge the maximum font-size. Even on a big screen, if the font is too large, it will affect the look and feel. The font-size I made back then was 20px.

    reply
    0
  • Cancelreply