In the book bulletproof web design the author mentions that specifying font size in pixel is not the right way from the point of accessibility.
Later in the book, he uses the margin and padding in pixels – My question is since pixel is relative to the resolution of the device – would that remain consistent – when accessed from different devices?.
Thanks to explain.
—
Update: Read the later notes by the author: The author “Try using ems for margins, padding, line height, and so forth to provide true scaling of your design (and not just text), regardless of font size.”
It seem’s that there is no one answer to this – just that if older browser support /accessibility issues are taken into consideration then relative measurements are preferred.
There’s a lot of opinion but no one best right/wrong way to do it. It all depends on context…the content, the site, the audience, the code, etc.
There’s nothing inherently inaccessible about defining your fonts in pixels. There was a time when it was hard to size the type via user-preferences in IE6, but that was a failing of IE6, not the px unit of measurement. Many folks now prefer to spec type in px (as do I) as it can make things easier on large sites with massive amounts of inherited CSS and a deeply nested DOM.
As stated, em is a measurement relative to the size of the type. So if you base padding and margins using ems, they will change in proportion to base font size of your page. Is that good? Again, it depends on your particular page layout and needs.