Is it allowed to have a self-closing div tag in an html document?

后端 未结 1 1903
滥情空心
滥情空心 2020-12-21 07:51

This question refers specifically to a script tag. I think it applies also to a div, but I just want to make sure. Is this legal html or not?

1条回答
  •  死守一世寂寞
    2020-12-21 08:08

    No it isn't legal HTML.

    The div element is not described as an EMPTY element in the DTD (4.01).

    The definition doesn't have EMPTY:

    
    
    

    Contrast with the definition for HR:

    
    
    

    0 讨论(0)
提交回复
热议问题