In this exercise we nested an
<img> element within an
<a> element to make images clickable links. Can we nest any element within
<a> tags? (li elements?)
With HTML5, the
<a> tag can now contain both inline and block-level elements. For example, we can nest heading elements within
<a> tags like so:
<a href=”#”><h1>Example</h1> </a>
This would make the entire
<h1> element clickable!
That having been said, one block-level tag which we do not want to nest within an
<a> tag is the
<li> tags should always be direct children to either
<ul>, or the experimental
To learn more about inline and block-level elements, check out our “Learn CSS” course.