Are XHTML self closing elements still valid in HTML5?

前端 未结 3 952
Happy的楠姐
Happy的楠姐 2021-01-14 11:12

I was wondering if I can write self closing elements like in XHTML in HTML5, for example, can be

3条回答
  •  悲哀的现实
    2021-01-14 11:51

    HTML5 can either be coded as XHTML, or as HTML 4. It's flexible that way.

    As to which is the correct way, that's a preference. I suspect that many web designers into standards are used to XHTML and will probably continue to code that way.

    You can go straight to: http://html5.validator.nu/ to validate your code, or if you have the right doctype, the official W3C site will use it for you.

提交回复
热议问题