- 4

Why we write <hr\> not like </hr>?

6th Sep 2015, 5:18 AM
Praddhyumn Mani
Praddhyumn Mani - avatar
17 Respostas
+ 9
Once upon a time, xhtml was a specification that required ALL tags have an end tag. Well, img, br, and hr do not have content, so they only had a start tag, they never needed an end tag. xhtml determined the solution to this would be to make the start tag and end tag the same tag in these situations, but just to make it annoying, the slash would go at the end, and we get things like <img />, <br />, and <hr />. You can leave the slash out of these and its still valid, but a lot of old veterans learned this weird habit and continue to use it in code even today.
30th May 2016, 1:42 AM
Murph Strange
Murph Strange - avatar
+ 5
The <hr /> is equal to <hr></hr>
8th Sep 2015, 4:43 AM
nick mour
nick mour - avatar
+ 2
Because it is an element. and element have not an end... so its start like this.. <hr /> other ex. <br /> for break line
28th Dec 2015, 6:49 AM
Krishana Sharma
Krishana Sharma - avatar
+ 2
Because it includes both opening and closing tags 👍
28th May 2016, 3:18 PM
Raj
Raj - avatar
+ 1
because it's an empty element. i.e. it doesn't have an opening and closing tag. that's how u differentiate an empty element and other elements. other elements have "/" at the beginning and empty elements have "\" at the end.
1st Jun 2016, 1:32 PM
Mohammad Fahad Sayed
Mohammad Fahad Sayed - avatar
0
we can't write because it is empty element it does not have closing tags so we can't write both
12th Sep 2016, 2:46 PM
ayushi
ayushi - avatar
0
hr its not content but paragraphe content Ă  text â˜ș(my english is french sorry 😂)
5th Oct 2016, 9:52 PM
edward
edward - avatar
- 1
beacause hr is a line tag not a content tag
9th Feb 2016, 11:27 AM
Ali Murtaza
Ali Murtaza - avatar
- 1
<hr/> is just the same as <hr></hr> because <hr/> is an empty HTML element.
29th Mar 2016, 6:52 AM
Bryan Ngeno
Bryan Ngeno - avatar
- 1
like <br\>
2nd Jun 2016, 4:44 PM
fathm
fathm - avatar
- 1
he he
5th Jun 2016, 6:11 PM
tarun prasad
tarun prasad - avatar
- 2
ithe backslash is not necesory in <hr /> and browser can show heading but if you want to write codes in strict format and in standard mode it's obligatory to write backslash
6th Mar 2016, 10:14 PM
amir nassaji
amir nassaji - avatar
- 2
Then only <hr> inought right. Why they gave three types?
29th May 2016, 4:53 AM
SRIBALU 91C1
SRIBALU 91C1 - avatar
- 2
have you try that? and what happen?
31st May 2016, 11:42 PM
Faisal
Faisal - avatar
- 3
In XHTML, the <br>, <hr> tags must be properly closed, like this: <br />, <hr />. But not in HTML5!!!
26th Feb 2016, 4:44 PM
Alex Philippov
- 3
we write <hr/> not </hr> because it is a horizontal line you are adding just like line break <br/>. Both needs no openings and closings tags.
27th Feb 2016, 6:02 PM
Lilian Martins
Lilian Martins - avatar