This is such a basic question
Is it OK to use px dimensions for all elements besides text - div, img, widths of block elements, etc?
I've used px to dimension all my block elements. How big a deal is that?
Personal computing discussed
Moderators: renee, SecretSquirrel, just brew it!
Nitrodist wrote:W3 has some tips.http://www.w3.org/QA/Tips/font-size
flip-mode wrote:Nitrodist wrote:W3 has some tips.http://www.w3.org/QA/Tips/font-size
OK, not to be an ass, but just to clarify, that looks like it's basically saying that it is just fonts that should be sized with em, but other elements there is no reason not to use px???
DIV.menu { padding: 1.5em }
By specifying the padding width in ems, the width of the padding is relative to the font size of the div element. As a designer, you don't really care what the exact width of the padding is on the user's screen, what you care about is the proportions of the page you are composing. If the font size of an element increases, the padding around the element should also increase. This is shown in figure 2 where the font size of the menu has increased while the proportions remain constant. (You can learn more about padding in chapter 9 .)