19. Easy Hard Rules
Confused? This is just one more option for creating fancy
dividers to mark the different sections of a web page.
After this lesson you will be able to:
- Create hard rule lines with different thicknesses.
- Create hard rule lines with different widths.
- Create hard rule lines without 3D shading
Note: We will not be modifying our web pages in this lesson- so you can just review the information and then decide if you want to experiment with it. You may want to first look at the test page to see of your browser supports the tags used in this lesson
NetScape's first HTML extensions offered some more formatting options for the <hr> tag (Hard Rule) - see lesson 4). The NetScape browser by default displayed the solid line separator with a three-dimensional, shaded look rather then the solid line as implemented in previous web browsers.
The first option is to allow for lines of different thicknesses by using the option:
where N is the thickness of the line in pixels. Let's look at some examples to show the effect (which does not show up very distinctly against the white background of this page).
<hr size=2> same as <hr> :
<hr size=8> :
<hr size=20> :
The other formatting option for the <hr> tag is to adjust the width of the line- it does not necessarily have to stretch across the whole page. You can do this by using this format:
where X is a number of pixels for the width and Z is the percentage of the current web page. In general we recommend using the percentage as it will adjust itself the width of the browser window used by the person reading your pages (some out there are using 2-page high resolution monitors while others are squinting into their 13" screen).
Here are some examples (see how we include the size tag as well):
<hr width=80 size=10> :
<hr width=80% size=10> :
NOTE: Try stretching and/or shrinking the width of your web browser window to see the difference between specifying the width in absolute pixels (width=80) vs specifying the width in percentage of the web page (width=80%)
<hr width=40% size=10> :
<hr width=5% size=10> :
Finally, there may be a case where you do not want the 3D shading on the <hr> tag. It is as simple as:
<hr width=80% size=6 noshade> :
Review topics for this lesson:
- How do you change the thickness of a hard rule?
- How can you change the width of a hard rule?
- What is the effect of the noshade attribute do inside the <hr> tag?
Experiment with some of the <hr> options in your own web pages.
Move it to the left... no! to the right... no! to the center...
Writing HTML Lesson 19: Spiffing Up Text
Maricopa Center for Learning and Instruction (MCLI)
Maricopa County Community College District, Arizona
The Internet Connection at MCLI is
Alan Levine --}
Comments to firstname.lastname@example.org