Example
<HTML>
<HEAD>
<TITLE>Example 5.04</TITLE>
</HEAD>
<BODY>
<H1>Horizontal Rules</H1>
<HR COLOR=#FF0000>
<P><HR size= 4 width=80% COLOR=#CCFFCC>
<P><HR size=10 width=40>
<P><HR size=10 width=40 ALIGN=”LEFT”>
<P><HR size= 5 width=20% ALIGN=”RIGHT”>
<P><HR size= 4 width=80% NOSHADE>
<P><HR size=10 width=40 NOSHADE>
</BODY>
To separate block of text in a document you can use the simple but useful <HR> tag which puts a straight line across the page. There is no ending tag for the horizontal rule. The very inclusion of <HR> introduces the separating the line.
When you use Internet Explorer you can change the size, width, colour and alignment of the horizontal rule using various attributes.
Size
The SIZE attribute defines the thickness of the horizontal rule. It changes the thickness by specifying the number of pixels with the value.
eg : <HR SIZE = 5>
Width
WIDTH attribute defines the length or width of the rule. A value is required for this attribute. This value can be expressed in pixel numbers or percentage, which determines the length based on the width of the browser window.
eg :
<HR SIZE = 8 WIDTH = 50> (Length of the line in Pixels)
<HR SIZE = 8 WIDTH = 50%> (Length of the line in percentage)
Alignment
ALIGN attributes align horizontal rules using one of the three values for ALIGN attribute, “CENTER” (align to the centre), “LEFT” (align to the left), or “RIGHT”
(align to the right).
eg :
<HR SIZE = 8 WIDTH = 50 ALIGN = "CENTER">
<HR SIZE = 8 WIDTH = 50% ALIGN = "LEFT">
<HR SIZE = 8 WIDTH = 50 ALIGN = "RIGHT">
The line is aligned to the centre even without specifying ALIGN attibute. This is because ALIGN = "CENTRE" is a default attribute value for the <HR> tag.
No Shade
NOSHADE attribute is used to shade the line and they have this 3D kind of
effect. If you don’t want this, use the NOSHADE attribute. NOSHADE takes no
values.
eg :
<HR SIZE = 10 WIDTH = 40 NOSHADE>
No comments:
Post a Comment