Html: What is the correct order of and

tags?

后端 未结 7 1208
予麋鹿
予麋鹿 2021-02-03 20:50

Which of the following, if either, is correct by standards?




        
相关标签:
7条回答
  • 2021-02-03 21:19

    Inline elements such as <a> are often contained within block-level elements such as <p>. The block elements provide the structure needed to present your data.

    0 讨论(0)
  • 2021-02-03 21:30

    You can't wrap a block element with an inline element. You have to do this in that way:

    <p><a href=''>Link Description</a></p>

    This is W3C standard. Check this!

    0 讨论(0)
  • 2021-02-03 21:32

    The first example is only allowed in HTML5.

    The second example is allowed in all versions of HTML/XHMTL.

    0 讨论(0)
  • 2021-02-03 21:36

    As of HTML 5, anchor tags (<a></a>) are allowed to wrap around almost anything, including paragraphs. So either example is valid, although I tend to prefer having anchors inside paragraphs.

    0 讨论(0)
  • 2021-02-03 21:38

    anchors (a) should be inside a block element. So

    <p><a>...</a></p>
    
    0 讨论(0)
  • 2021-02-03 21:38

    I always put the <p> tags inside unless the amount of text is large.

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