+ 9

They say that inline level elements cannot contain block level elements.

But below is an anchor link which contains h1 element. It is still clickable. <a href="#"><h1>Click</h1></a>

23rd Mar 2017, 10:50 PM
Wilson Bol
Wilson Bol - avatar
2 Réponses
+ 9
yes, it works. but it's invalid html. browsers aren't that strict, so they interpret the page as it's intended. it would be funny and a horror if they'd display error messages instead...
23rd Mar 2017, 11:00 PM
Mario L.
Mario L. - avatar
+ 3
you can make inline element a block level then use block level tags inside it a{ display:block; }
17th Aug 2018, 8:42 PM
Amir Ahmad
Amir Ahmad - avatar