This tag is used to produce a horizontal rule or line. It is useful for visually separating parts of a page. A basic example of its use appears below.
This determines whether the line is left, centre (default) or right aligned. The associated values of the attribute are left, center and right. The effect is best illustrated with lines of less than full width. Here are examples of left, centre and right alignment with a line half the window width.
This attribute which takes no value specifies that the line be drawn solid rather than the usual "3-D" effect. Here are examples showing the effect, first the usual form then the noshade form. A thicker than normal line is used.
The value of this attribute specifies the line height or thickness in pixels. Here are some examples.
size | shaded | example |
---|---|---|
5 | Yes | |
15 | Yes | |
10 | No | |
default | Yes |
This specifies the line length either in pixels or as a percentage of the available space between the current margins. The first set of examples show left aligned lines of length 20, 40 and 80 pixels.
and the next set of examples show centrally aligned lines of length 25%, 50% and 75% of the current space.
This is not an HTML 3.2 tag but is supported by IE. As might be expected from the name of the attribute it controls the colour of the line. Here's a red horizontal rule, if your browser understands the attribute.
Browsers
All browsers honour the tag in its basic form.
There are significant differences in the following aspects.
MOS3, IE4, NN and ARA start full width horizontal rules at the current indent, this is consistent with the placing of paragraphs and other block elements. IE3 generates full width horizontal rules starting at the left hand window margin and OP2 starts them at a position intermediate between the window margin and the current indent.
MOS3, IE3, NN, OP2 and ARA generate a full line height gap between successive horizontal rules. IE4 only produces a gap equal to the line height beneath and a full line gap above.
In practice the use of the attributes is uncommon. Lines decorated with small furry creatures etc., are images and are generated using the <img> tag and a suitable image file. There is, of course, no way of specifying a dotted or dashed line.