<hr width="10%" align="right" /> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

<hr width="10%" align="right" />

For the align attribute lesson, why is the horizontal line element not closed before defining its attributes? I mean its tag should be closed before defining attribute for it. <strong>#iamconfused</strong>

25th Oct 2018, 11:55 AM
Wisdom Johnson
Wisdom Johnson - avatar
2 Answers
+ 2
In HTML, the <hr> tag has no end tag. In XHTML, the <hr> tag must be properly closed, like this: <hr />. https://www.w3schools.com/tags/tag_hr.asp
25th Oct 2018, 12:20 PM
Mbrustler
Mbrustler - avatar
+ 1
A little bit on why, see "Empty HTML Elements": https://www.w3schools.com/html/html_elements.asp In the specifications: https://dev.w3.org/html5/html-author/#void
25th Oct 2018, 6:42 PM
Janning⭐
Janning⭐ - avatar