I was wondering whether it is possible to prevent following behaviour: I've got a *.css file in which I define the font-size for my mobile-web-app.
html,body { font-size:16px !important; }
I didn't use any other font-size attributes in my files.
Now, when I turn into the landscape mode, the font-size changes.
How can I prevent or manipulate this behaviour. Do I have to use @media screen and (max-width: x px) { }
or is there any other way?
Thanks for sharing.
If the font changes, it's because the app you have open changed it, not you. But that doesn't mean you can't edit the text at all. Every iPhone lets you change the font size, making it either bigger or smaller. This is great for users with impaired vision, or with magnified screens.
The zoom setting is on. You can turn it off via accessibility settings or double tap with three if gers and move three fingers down on the screen.
You may need to use extra selectors but the following should do the trick.
html,body { -webkit-text-size-adjust:none; }
So that this rule doesn't prevent text resizing in WebKit desktop browsers (Chrome, Safari and soon Opera), wrap it in a CSS media query targeting the desired devices like so:
/* iPhone, portrait & landscape. */
@media all and (max-device-width: 480px) {
html,body { -webkit-text-size-adjust:none; }
}
/* iPad, portrait & landscape. */
@media all and (min-device-width: 768px) and (max-device-width: 1024px) {
html,body { -webkit-text-size-adjust:none; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With