Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what units do you use for css for mobile web apps?

px? em? pt? seems like with varying device sizes and densities it's getting to be time to use something absolute like pts. Can anyone point me to a good, recent write-up of what to use when?

(I'm specifically targeting webkit-based mobile devices as my primary platform, though the site needs to work on large monitors, as well. I'm fine ignoring IE and older browsers for the most part.)

like image 873
sprugman Avatar asked Feb 12 '11 15:02

sprugman


3 Answers

Check out this and that from Luke Wroblewski. Googling his name will find more.

like image 108
Paul Beusterien Avatar answered Sep 19 '22 00:09

Paul Beusterien


As you say with high density phones you should avoid px but also pt that originally was for printing. As you setup your site to comply with most browsers, mobile or not, set your body font-size using percentage (historically better support I say without source) and then use em through your document. This allow your users to set their preferred font-size in their (mobile phones) browser settings and let you keep your relations between your different font-sizes.

like image 40
D.Nibon Avatar answered Sep 19 '22 00:09

D.Nibon


As a web developer, I stick to pixels because this is already a standard for all digital display devices. Most mobile phones now come in screens based on pixels, and phones are able to resize to fit your content.

You simply have to make sure that you minimize the amount of content on each page for fast loading and rendering.

like image 23
mauris Avatar answered Sep 22 '22 00:09

mauris