Basic HTML Tutorial

BHP HTML Basics - Making Rules

Using Horizontal Rules
In addition to using the <H#> tag to show how your page is divided in sections, another useful tool is the Horizontal Rule, made with the <HR> tag.
The <HR> tag, when used without any attributes will typically place a 3 pixel thick shaded line across the width of the browser window.
The WIDTH attribute may be used to set the width of the bar, using either a percentage of the browser window or a fixed pixel size.
This HR will extend across 50% of the window.
<HR WIDTH="50%">
While this HR will extend 50 pixels.
<HR WIDTH="50">
This HR will extend across 50% of the window.
While this HR will extend 50 pixels.
You will notice that, by default, the rule is aligned in the center of the window. This may be controlled by using the ALIGN attribute in the <HR> tag. This will work exactly like the ALIGN attribute that we saw earlier in the <P> tag.
<HR WIDTH="50%" ALIGN="left">
<HR WIDTH="50%" ALIGN="center">
<HR WIDTH="50%" ALIGN="right">

The size of the bar may also be set by using the SIZE attribute. This sets the size of the bar in pixels.
<HR WIDTH="50%" ALIGN="left" SIZE="5">
<HR WIDTH="50%" ALIGN="left" SIZE="10">
<HR WIDTH="50%" ALIGN="left" SIZE="20">

Suggested uses of the <HR> tag are to divide the sections of your content, to set apart your navigational features from your content and to mark the beginning and ending of forms.
Grab the Code
With the <HR> tag, we gain another way of setting apart sections of our page. We have good control over the appearance throough the use of the WIDTH, ALIGN and SIZE attributes.
In the next section, we will look at a way to point to another file on the web. This will help us to add images to our pages and to make links to othere web sites.
Back Next
[Back] [Table of Contents] [Next]
Copyright 2000 John H. Bolgiano, Jr. - All rights reserved
Modified with permission for educational use by Roberta Bush