Is it wrong to change a block element to inline with CSS if it contains another block element?

后端 未结 9 1411
遇见更好的自我
遇见更好的自我 2020-11-22 16:25

I know it\'s wrong to put a block element inside an inline element, but what about the following?

Imagine this valid markup:

This

9条回答
  •  我在风中等你
    2020-11-22 17:06

    Are the page elements still valid?

    “Valid” in an HTML sense, yes; HTML knows nothing about CSS.

    The rendering you get in the browser, however, is ‘undefined’ by the CSS specification, so it could look like anything at all. Whilst you could include such a rule in CSS hacks aimed at one particular browser (where you know how that browser renders this case), it shouldn't be served to browsers in general.

提交回复
热议问题