- 4
Why we write <hr\> not like </hr>?
17 odpowiedzi
+ 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.
+ 5
The <hr /> is equal to <hr></hr>
+ 2
Because it is an element. and element have not an end... so its start like this.. <hr />
other ex. <br /> for break line
+ 2
Because it includes both opening and closing tags 👍
+ 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.
0
we can't write because it is empty element it does not have closing tags so we can't write both
0
hr its not content but paragraphe content à text ☺(my english is french sorry 😂)
- 1
beacause hr is a line tag not a content tag
- 1
<hr/> is just the same as <hr></hr> because <hr/> is an empty HTML element.
- 1
like <br\>
- 1
he he
- 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
- 2
Then only <hr> inought right. Why they gave three types?
- 2
have you try that? and what happen?
- 3
In XHTML, the <br>, <hr> tags must be properly closed, like this: <br />, <hr />. But not in HTML5!!!
- 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.