views:

261

answers:

1

What is the correct code to create a link with heading 1 according to web standards?

is it

 < h1>< a href="http://stackoverflow.com"&gt; stackoverflow < /a>< /h1>

or

 < a href="http://stackoverflow.com"&gt;&lt; h1> stackoverflow < /h1>< /a>

Thanks

+14  A: 

its the first one. According to standards you aren't allowed to put block elements into inline elements.

As h1 is a block element and an a is an inline element the correct way is:

<h1><a href="#">This is a title</a></h1>

here is a link so you can learn more: w3 Visual formatting model

Darko Z