In the <button>
specification part we see that permitted content is only Phrasing content. It's valid HTML code part (checked here):
<button>
<span></span>
</button>
This is not valid HTML code part (checked here):
<button>
<div></div>
</button>
Error: Element div not allowed as child of element button in this context. (Suppressing further errors from this subtree.)
But we can change display
property of the <span>
:
<button>
<span style="display: block"></span>
</button>
And it looks like we use a <div>
instead a <span>
, but the HTML is valid. Is it OK (by the specification) to use a permitted content element and change its display
property?
tag… right or wrong?_](https://stackoverflow.com/q/4291467/1079869) and [_Putting a block level element inside a
– Matias Kinnunen Aug 15 '21 at 06:41element_](https://stackoverflow.com/q/18930438/1079869)