can we give attributes to <br>
and other empty elements except <hr>
.
like in <hr>
we can give style properties and in html documentation they wrote All HTML elements can have attributes
so <br>
also have any attributes as <br>
element is empty element.
2
Answers
According to MDN docs:
So, the answer is yes, we can give it attributes.
yes, Expect for tag
<hr>
it is possible to give the attribute to all the empty tags including<br>
. the reason we cannot give<hr>
tag attribute is because it displays a line in html page, which cannot take any data or text. for more information, you should refer to documentation like MDN documentation