Are there CSS or other reasons why Safari/iPhone would ignore some font-size settings? On my particular website Safari on the iPhone renders some font-size:13px text larger than font-size:15px text. Does it maybe not support font-size on some elements?
相关问题
- Adding a timeout to a render function in ReactJS
-
Why does the box-shadow property not apply to a
- Add animation to jQuery function Interval
- how do you prevent page scroll in textarea on mobi
- jQuery hover to slide?
I had the same problem, turns out in the original CSS there was this line:
-webkit-text-size-adjust: 120%;
I had to change it to 100%, and everything was smooth. No need to change all px to em or %%.
Also check if you don't have a "width/height" set to the elements you're manipulating, Safari gives sizing precedence over font size in svg's, Chrome and FF don't, it seems, currently at least.
Also, make sure you are setting the initial zoom setting to 1 in your viewport meta tag:
I don't use pixel definitions anymore as they are really confusing and aren't exactly the same across visual services.
Meet the Units
Use 100% instead of None.
normalize.css includes this
Joe's response has some good best practices in it, but I think the problem you're describing centers around the fact that Mobile Safari automatically scales text if it thinks the text will render too small. You can get around this with the CSS property
-webkit-text-size-adjust
. Here's a sample of how to apply this to your body, just for the iPhone: