Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Header inside Link or Link inside Header in HTML markup? [duplicate]

Tags:

Possible Duplicate:
Which is more correct: <h1><a>..</a></h1> OR <a><h1>..</h1></a>
Semantically, which is more correct: a in h2, or h2 in a?

This is a simple question about HTML. What is the right/most preferable way to put a link in a header, paragraph or another HTML element?

This way:

<h2><a href="">Some Title</a></h2>

Or this way:

<a href=""><h2>Some Title</h2></a>

like image 327
Renato Dinhani Avatar asked Jun 21 '12 20:06

Renato Dinhani


1 Answers

Better is

<h2><a href="">Some Title</a></h2> 

because h is element with display block and is not good practice to have block in a element.

like image 57
Mateusz Rogulski Avatar answered Apr 05 '23 10:04

Mateusz Rogulski