0

How canny close a tag after opening <img src>

18th Feb 2017, 12:17 PM
Eneh Chris
Eneh Chris - avatar
3 Respostas
+ 2
img is self closing, you can - but don't need to - write <img src="image.png" /> the slash at the end isn't necessary. if I'm not mistaken, it was recommended in HTML4, but it's obsolete in HTML5. I'm not sure about that.
18th Feb 2017, 12:20 PM
Mario L.
Mario L. - avatar
+ 2
The requirement of ending slash ( / ) in self closing ( empty ) tags was only for XML branch of Html ( XHtml)... Syntaxe of Html is relatively permissive ( because based on SGML, as XML is too, while XHtml is based on XML ), so browsers accept it, but that's not valid code: it must be avoided ^^
19th Feb 2017, 10:15 AM
visph
visph - avatar
0
image tags do not need a closing tag. They are closed with a / before the > like so <img src/>
18th Feb 2017, 12:20 PM
Orfeo Terkuci
Orfeo Terkuci - avatar