views:

15

answers:

2

I have block level elements with its height property set in %. Inside these block level elements are <span>s with text. Example:

<body style="height: 100%;">
    <menu style="height: 10%;">
        <button style="display: block; height: 100%;">
            <span style="font-size: 4em; line-height: 200%;">text</span>
        </button>
    </menu>
</body>

This looks fairly well on a mobile browser, except when I rotate the device (that is, once the body.onorientationchange event kicks in), the text becomes too big.

So my question is, how can I specify the text size relative to the height of the parent element?

+1  A: 

I've run into similar issues on the iPhone and it wasn't the height causing the issue, but rather an option of mobile webkit.

Try setting this

body {
    -webkit-text-size-adjust: none;
}
Marko
Nice! But according to [this link](http://css-infos.net/property/-webkit-text-size-adjust) in only applies for Mobile Safari on iOS. Is there an alternative for the default Android browser?
Attila Oláh
A: 

This will disable font size change on rotation, which pretty much solves my problem. Borrowed from here.

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0;">
Attila Oláh
Hi @Attila - accept this please :)
Marko
One can only his/her own answer after two days, remember? A fow more hours to go...
Attila Oláh