0

div {display: inline}
<div>
  <p>Wow</p>
</div>

is this be valid? And if you know references related to this, please let me know.

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
newbieeyo
  • 663
  • 4
  • 12
  • You're confusing HTML's rules with CSS's box model. As it is, your HTML is fine because both `p` and `div` are block-level elements. Changing `div`'s style to have `display: inline` does not affect the semantics of the DOM. – Dai Jan 23 '21 at 12:03
  • don't do it, it's wrong (to be more accurate, it will give a starnge result that you won't like) – Temani Afif Jan 23 '21 at 12:05
  • @TemaniAfif But it isn't "wrong" - it's just unusual. – Dai Jan 23 '21 at 12:06
  • @Dai it's *wrong* if we consider the expected result. It's not *wrong* from a code perspective or a validation (the Spec also clearly define how this should behave) – Temani Afif Jan 23 '21 at 12:07

0 Answers0