Knowing Horizontal Rules and How to Apply Them

To start practicing this, first understand what exactly it is: HTML5: Understanding Elements.

Continuation of Understanding Element:

Horizontal rules are used to create horizontal lines in the browser window. It divides an HTML page into horizontal segments. Horizontal rules are required when different types of content must be displayed separately on the same HTML page. The HR element represents the horizontal rule. It is an empty tag, which means it contains no content.

AttributePurpose
classDefines the name of the class
langDefines the language for the rule
dirDefines the direction of the rule, that is from left to right or right to left
idDefines the value of the id
onClickOpens an HTML document on a mouse click
onDblClickOpens an HTML document on a double-click
onKeyDownOpens an HTML document on pressing a key
onKeyPressOpens an HTML document on pressing and releasing the mouse button
onKeyUpOpens an HTML document when a key is released
onMouseDownOpens an HTML document on clicking of a mouse button
onMouseMoveOpens an HTML document on moving the mouse pointer
onMouseOutOpens an HTML document when the mouse pointer moves out of the element
onMouseOverOpens an HTML document when the mouse pointer moves over the element
onMouseUpOpens an HTML document on releasing the mouse button
styleDefines inline style of the element
titleProvides extra information about the element
Table 7.1 – List of Attributes of Horizontal Rule

Working with Horizontal Rules

As previously described in the IN-DEPTH section, horizontal lines are used to divide an HTML page. Horizontal rules are also used to separate the content of an HTML page. To further understand how to use the horizontal rule tag, let’s construct an HTML file called hor-rule.html. Below is the code for the hor-rule.html.

In the above code, the horizontal rule separates the HTML page into three portions. The sections are separated by a horizontal line or rule.

Figure 7.1 – Displaying the Output of Using the Horizontal Rules

Scroll to Top