Do all attributes comes only in opening tag? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Do all attributes comes only in opening tag?

29th Jun 2018, 5:22 PM
Daksh Verma
Daksh Verma - avatar
2 Answers
+ 6
The answer is no for most tags. However, you could argue that tags like "img" that can be self-closing, are able to have attributes in them. But these self-closing tags are taking the place of an opening tag and a closing tag, so it's not the same as having an attribute in a closing tag. To be honest, there is really no need for this, it would just create more for the browser to have to read and make the page size bigger. https://stackoverflow.com/questions/4138006/can-i-have-attributes-on-closing-tags
29th Jun 2018, 5:26 PM
Koketso Dithipe
Koketso Dithipe - avatar
+ 1
No some like <a>,<img>,<br>,<hr> start and ends on same tag , means doesn't need closing tags
29th Jun 2018, 5:28 PM
Sudarshan Rai
Sudarshan Rai - avatar