In HTML which way round should and

be nested?

前端 未结 3 1192
无人共我
无人共我 2021-02-13 19:29

Is there a more correct order for nesting a and

elements in HTML?

e.g.:

         


        

3条回答
  •  时光取名叫无心
    2021-02-13 19:53

    In HTML 4.01 and XHTML 1.1 and older:

    • An h1 may contain an a
    • An a may not contain an h1

    So

    In the HTML 5 draft:

    • An h1 may contain an a
    • An a may contain an h1 (but only if the a is somewhere an h1 is allowed — see the comments on this answer)

    So either, but browser support may vary (such is life on the bleeding edge).

提交回复
热议问题