What is the correct code to create a link with heading 1 according to web standards?
is it
<h1><a href="http://stackoverflow.com"> stackoverflow </a></h1>
or
<a href="http://stackoverflow.com"><h1> stackoverflow </h1></a>
Thanks
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.
According to web standards you aren’t allowed to put block elements into inline elements.
As
h1is a block element andais an inline element the correct way is:Here is a link so you can learn more: w3 Visual formatting model
However, there is an exception that in HTML5 it is valid to wrap block-level elements (like
div,porh*) in anchor tags. Wrapping block-level elements in inline elements other than anchors still goes against the standards.