I read that in HTML, a block-level element can't be used inside of an In-line element. For example, <span>Hi <div>!</div></span>
is not possible as <span>
is an In-line element and <div>
is a Block-level element.
But, I also read that <a></a>
is an In-line element and have frequently seen <div>
tags being used inside of a <a>
tag. How is this possible and what am I missing?
Asked
Active
Viewed 21 times
0

peikado
- 75
- 1
- 8
-
The content model for `` was changed from what it originally was. – Pointy Dec 09 '21 at 14:57
-
1[Is putting a div inside an anchor ever correct?](https://stackoverflow.com/q/1827965/4543207) – Redu Dec 09 '21 at 14:58
-
@Redu that question is quite old. The modern HTML5 spec allows the "transparent" content model. The only things not allowed are other interactive elements (like ` – Pointy Dec 09 '21 at 15:00
-
1@Pointy Then it's probably better to extend that popular question with new answers covering modern HTML. – Redu Dec 09 '21 at 15:06
-
@Redu I agree with this. – peikado Dec 09 '21 at 18:30