+ 1
Can I ask why it is optional to add an '/' in img tag in html?
4 Respostas
+ 1
I think to avoid development issues
+ 4
For self-closing tag it is optional in modern HTML syntax.But good habits is to close what is opened in tags that contain elements or other HTML inner element inside it but for img will not have other element or content inside it except img URL
+ 3
You must be talking about how relative URL's don't need a /.
If an image is in the same directory as the HTML, a / is unnecessary. Relative paths are interpreted in the context of the current page's URL. If "/" is nowhere in a URL, it is assumed to be in the same protocol, host, and path as the page that mentions it.