Quick Tip - 01: HTML5 A Tags, & Block Level Elements

January 12, 2014 | 0 Minute Read

HTML5 is different than XHTML in many ways. One thing that XHTML never had was a way to make block-level elements clickable without using JavaScript. Well, in HTML5 it's now possible.

That’s right, it seems a little weird but it is now valid to wrap block-level elements such as <div>, <h1>, and <p> tags for example within HTML5 a tags.

So, It’s now perfectly acceptable to do this:

<a href="https://briantree.se/">
    <h1>Brian Treese</h1>
    <p>Web Design and Development Tips, Techniques, Inspiration & More</p>
</a>

What I didn’t know is that this isn’t totally new. When using XHTML 2 it was valid to add an href attribute to any element, essentially doing the same thing.

Sources

Found any of this Stuff Helpful?

If you found any this helpful and want to show some love, you can always buy me a coffee!