Robert Robert - 1 year ago 51
Android Question

font-size increases unexpectedly in mobile webkit

I'm working on optimizing a website for mobile devices, and I'm nearly done (yay!) but one thing makes me rack my brain:

How it works

I used CSS to restyle a tab-bar (actually a list) to work like a dropdown-menu. When touching the only visible list element, jQuery toggles the class "open" on the

-element and all list elements appear also. That's how it works.

The Problem

When unfolding the dropdown-menu, it's font-size increases from 15px to 19px. And in Inspector there is absolutely no hint why this happens. Adding a rule like
font-size: 15px !important;
has no effect.

I made a little screencast for you:

Affected devices

  1. Android (Samsung Galaxy)

  2. iOS (iPod, iPhone, Simulator)

Windows Phone (Internet Explorer) is not affected (wow!)

I would be very thankful for every single idea!!

Answer Source

It turned out, that Mobile Webkits font resizing was the origin. This rule solved it:

-webkit-text-size-adjust: none;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download