• without parent tags?
  • 后端 未结 7 842
    生来不讨喜
    生来不讨喜 2021-01-13 02:23

    Is it ok to use

  • tags without parent tags?

    i.e.

  • some copy
  • or must it be..

  • 相关标签:
    7条回答
    • 2021-01-13 02:54

      If by OK you mean "correct, follows standards and will validate" then no. Per the spec, only OL and UL can contain LI. (MENU and DIR are deprecated)

      If by OK you mean "will render" then yes.

      Also, to be "OK" by the first definition, you must also close your LI tags. Every tag must either be self-closing (/>) or have a corresponding closing tag. Here's a quick and simple explanation of correct XHTML (and honestly, good HTML should conform to these as well. No reason not to.)

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