<hr/> Tag Syntax
Rules for coding HTML hr/
elements
<body> ... ... flow content expected ... <hr/> ... </body>
Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.
- To add a horizontal rule, code a hr element where flow content is expected.
- Begin the p element with a starting <p> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the
xmlns
attribute on the <html> tag. - Include any HTML global attributes on the <hr> tag as appropriate.
- Since the hr element is a void element, the HTML code consists of a standalone <hr/> tag terminated with the self-closing delimiter string
/>
.
<hr/> Content Model
Contents of the hr element
Content: Empty. Any properties are coded using global attributes.
Since the <hr/>
tag is a void element, it is not allowed to have any content, even HTML comments and therefore should always be coded as a self-closing standalone tag, ending with the delimiters />
rather than just >
(<hr/>
).