Yes, you can wrap block elements inside an anchors
Publié le 03/01/2013
Par Damien
149 mots
DevBlog
Précédemment sur le blog :
Histoire d'une anamorphose
I saw this a lot but few developpers knows about it (there is still questions about this on StackOverflow).
HTML5 introduce an awesome change in the a
element. From
the spec:
Although previous versions of HTML restricted thea
element to only containing phrasing content (essentially, what was in previous versions referred to as inline content), thea
element is now transparent; that is, an instance of thea
element is now allowed to also contain flow content (essentially, what was in previous versions referred to as block content)—if the parent element of that instance of thea
element is an element that is allowed to contain flow content.
That means you can use div
inside an anchor:
<a href=""> <div> <p> pony </p> </div> </a>
Now, you knows. Happy new year too!