Today is a good day to code

iPhone CSS Rendering Strangeness With Em Sized Elements

Posted: December 31st, 1969 | Author: | Filed under: Uncategorized | No Comments »

iPhone CSS Rendering Strangeness With Em Sized Elements

Picture of IrvinToday I was looking at why some of my display elements were strange sizes in the interface. The reason is that I had set some widths to em(s), and the em of course changes as the interface changes scale. This frequently causes the display to break, especially if the other elements are based on px or pixel values.

The way around this is to choose your poison and be consistent. For the sake of development simplicity, I'd use px in my iPhone stylesheet. EMs are great, but when the interface won't actually allow font size scaling, instead zooming, the benefit of EMs is questionable.