HTML and CSS Reference
In-Depth Information
Figure 5-4. The long and short of absolute and relative
rule widths
The following rules are 40 and 320 pixels wide no matter
the actual width of the browser window:
<hr width=40>
<hr width=320>
Whereas these next two rules will always extend across
10 and 75 percent of the window, regardless of its width:
<hr width="10%">
<hr width="75%">
Notice, too, that the relative (percentage) value for the width attribute
is enclosed in quotation marks; the absolute (integer) pixel value is not.
In fact, the quotation marks aren't absolutely necessary with standard
HTML (though they are required for XHTML). Further, because the per-
cent symbol normally means that an encoded character follows it, failure
to enclose the percentage for the width value in quotation marks may
confuse some browsers and trash a portion of your rendered document.
In general, it isn't a good idea to specify the width of a rule as an exact
number of pixels. Browser windows vary greatly in their width, and what
might be a small rule on one browser might be annoyingly large on an-
Search WWH ::

Custom Search