Specifying sizes/positioning in CSS

liunx

Guest
I am learning CSS and have a question about specifying sizes. I understand the basics for units of measurements, i.e px, pt, and so on, but I am wondering what is the best practice in terms of accessiblity, flexibility...and the pros and cons of using a specific unit? For example, if I want to specify a font size, what happens to my text with the different units of measurements when they are viewed on some unknown computer set-up? What about percentages? And, also in regard to positioning...how do these things translate to the end user, and what things should I be thinking about when I use certain techniques?Pixels are global units--they are the same size on any computer. In addition to points (pt), centimeters, inches, and any other metric or English measuring unit should only be used for print stylesheets. Percentages are relative units so they are less reliable than pixels. I would recommend a fixed-width layout with specific pixel-widths than a liquid layout which uses percentages for its widths. Vladdy explains why fixed is better than liquid (<!-- m --><a class="postlink" href="http://www.vladdy.net/Demos/ElementSizing.html#pl">http://www.vladdy.net/Demos/ElementSizing.html#pl</a><!-- m -->). There also are units based on font sizes. These are the best units to use (as explained in Vladdy's article). They are "EM" and "EX." One "EM" is 100% of the default font size. "1.5" EMs displays a 150% font-size. One "EX" is the "x-height" of the current font. The "x-height" usually is the height of the lowercase "x" of the current font -- however large or small it may be by default. This means that an "EX" is also a relative font-size unit. Read more at <http://www.w3.org/TR/CSS2/syndata.html#length-units>.
 
Back
Top