HTML and CSS Reference
In-Depth Information
Percentage Calculations and the Box Model
50% + 50% = 100%
30% + 30% + 40% = 100%
Correct?
Sometimes it isn't. Because of rounding in the calculations involved
in finding the percentage of the measurement it relates to, there may
be an extra pixel or two to account for. Internet Explorer 6 is notori-
ous for calculations that result in extra pixels and, as a result, for col-
umns that don't fit into a space you think they should.
You can find more about layouts and the box model in Chapter 5.
Other Units of Note
Points are considered an absolute length -based units: They correspond to
a physical measurement of 1/72 of an inch (approximated by the browser
and device). Other absolute units include in (inches), cm (centimeters),
mm (millimeters), and pc (picas, or 12pts).
Pixels and ems are relative length -based units: They are relative to some
other measurement. Like em , the ex unit is relative to the size of the font
(the ex-height or height of the character “x”). CSS3 has defined some
other interesting relative length units such as the following: rem (relative
to the font size of the root element) and vw and vh (relative to the view-
port width and height, respectively). These units are just starting to be
supported in previews of the next generation of browsers but are some-
thing to look forward to using.
 
 
Search WWH ::




Custom Search