I use this in visual studio but the compiler claimed that h1 cannot be nested in legend element, but browser can render it anyway so i am confused that this is valid or not?
<fieldset>
<legend>
<h1>Caption</h1>
</legend>
</fieldset>
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are many things that browsers do that aren’t required by the standards 🙂
This page here (HTML4) specifies the
legendkeyword and states that it can contain inline elements, of which the headers are not a part. It does have other possibly useful ones such asbigorstrong.In addition, the relevant page for H1 does not list
legendas one of the items it’s allowed to be contained within. You may also be able to use theid,classorstyleattributes of the legend to set the underlying textual properties.