Difference between DIV as-is and a SPAN with display:block

前端 未结 4 1347
夕颜
夕颜 2020-12-09 08:06

Is

different from in any way?

They render just fine the same. Any semantic difference b

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 08:29

    Yes they are different.

    Even though you style a span with display: block you still can't put block-level elements inside it:

    correct

    wrong

    The (X)HTML still has to obey the (X)HTML DTD (whichever one you use), no matter how the CSS alters things.

提交回复
热议问题