+ 1
Question on html
Hi everyone, hope you're having a great day. I have this question about html, I took a beginner and intermediate course on Mimo app, and then started learning it on sololearn from the beginning, and I found some changes, for example: 1.using <hr> instead of <br> 2.using <img src="/> instead of <img src="> Can someone please explain.
1 Answer
+ 2
1.
I think some tags are used to modify semantics, and some tags are used to decorate the page.
The following content is copied from other sites.
https://html.spec.whatwg.org/#the-hr-element
The hr element represents a paragraph-level thematic break, e.g. a scene change in a story, or a transition to another topic within a section of a reference book.
https://html.spec.whatwg.org/#the-br-element
br elements must be used only for line breaks that are actually part of the content, as in poems or addresses.
2.
https://html.spec.whatwg.org/#void-elements
void elements (elements that have no end tag in the HTML syntax).
area, base, br, col, embed, hr, img, input, link, meta, param, source, track, wbr
http://xahlee.info/js/html5_non-closing_tag.html
Is the Ending Slash Optional?
HTML5: the slash is optional.
HTML4: the slash is technically invalid. However, it's accepted by W3C's HTML validator.
XHTML: The slash is REQUIRED.