what is difference between <hr> and </hr> both are working same. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

what is difference between <hr> and </hr> both are working same.

21st Jun 2016, 1:37 AM
Manoj singh jalal
Manoj singh jalal - avatar
10 Answers
+ 2
@Alex <hr> is the correct HTML5 variant compared to <hr /> (Which is valid too). The latter is from XHTML.
21st Jun 2016, 3:10 PM
ZinC
ZinC - avatar
+ 2
@Memea There's no opening and closing tag for hr, you have to use only one. If you do like this <hr><hr/> the browser will display two lines.
21st Jun 2016, 11:08 PM
ZinC
ZinC - avatar
+ 2
so, why are <hr/> <br /> the preferred forms?
3rd Jul 2016, 5:43 PM
Kenshin
Kenshin - avatar
+ 1
I think you meant <hr> and <hr /> ? Right? There is no difference, it is the same tag. Just like <br> and <br />
21st Jun 2016, 7:19 AM
James Flanders
+ 1
you can use any one for your horizontal lines. but remember there is no open and close tags for horizontal lines, you either use <hr> or <hr/> just choose one.
30th Jun 2016, 2:12 AM
Benjamin
Benjamin - avatar
0
<hr/> is actually an empty tag. However, this one has a special meaning as it means to break up sections of the code with a horizontal line.
22nd Jul 2016, 6:12 AM
Matt Bailey
Matt Bailey - avatar
- 3
create horizontal line
21st Jun 2016, 2:31 AM
Md Imam Hossain
Md Imam Hossain - avatar
- 3
horizontal line
21st Jun 2016, 6:20 AM
Gokul S
Gokul S - avatar
- 3
they are opening and closing tags for a horizontal line. no difference.
21st Jun 2016, 8:43 PM
Memea Elis
Memea Elis - avatar
- 4
<hr /> is valid html5 <hr> isn't.
21st Jun 2016, 8:33 AM
Alex Wood
Alex Wood - avatar