HTML5 closing tag /> for meta or style sheets

There are certain types of documents that need a closing tag /> and there are others that need only > .

For example, <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
or <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" >

How is it with HTML5? Is this something I need to consider?

+4
source share
1 answer

Tags that have an opening and closing tag (anchors, span, divs, etc.) do not need / "> because / is in the closing tag.

It is assumed that those that stand alone (br, hr, img, etc.) now have / ">.

As far as I understand, this is not necessary, but it was introduced into the game for HTML5 for the sake of consistency with XML and XHTML.

I read that before / "> you need to put a space so as not to confuse old browsers.

+3
source

Source: https://habr.com/ru/post/1338268/


All Articles