attribute determines the
hr element’s width in pixels
(or as a percentage of the containing element, if the % symbol is
included); if no width is specified, the
hr will take
up 100% of its containing element.
This code creates a red, ten-pixel-high horizontal line that’s 50% of the width of the containing element:
<p>And with that the actress explained to the bishop, through a series of hand gestures, that she was in fact mute and could not possibly have said what she was reported to have done.</p> <hr color="red" size="10" width="50%"/> <div id="footer">© All content copyright 2007. Even the unfunny stuff.</div>
Figure 1 shows a horizontal rule set to 50%. The red border is added only to show scale.
This attribute takes as its value a number wrapped in quotes (which is understood and rendered as pixels on screen, so there’s no need to specify unit of measurement, as per the example above), or a percentage figure.
width attribute is well supported, but as a
deprecated (presentational) attribute, it should not be
There are no comments yet.