Which is better to use in CSS, percentage or pixels?

You won't have any problems using this approach, both percentage and pixels work fine depending on your needs. If you need a fluid site, then percentage might be your best option. And ems for the fonts, so the user can modify its display if necessary.

Couple of expert's opinions on this:

https://kyleschaeffer.com/css-font-size-em-vs-px-vs-pt-vs-percent

http://webdesign.about.com/cs/typemeasurements/a/aa042803a.htm

And here's an interesting twist: Percentage + pixels:

http://www.cssplay.co.uk/boxes/outside.html


I guess you should have a look at this:

http://kyleschaeffer.com/best-practices/css-font-size-em-vs-px-vs-pt-vs/

It depends on your needs, I tend to use em instead of pixels or percentages. Also I've noticed that IE does not "eat" percentages too well but ems are working great.

Tags:

Css

Resolution