本文介绍了HTML:< a>的正确顺序是什么?和< p>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下哪一项(如果有的话)在标准上是正确的?
<!-- Do the links surround the target link object -->
<a href=''><p>Link Description</p></a>
<!-- or does the object type encapsulate the link-->
<p><a href=''>Link Description</a></p>
我知道它们的功能相同,但这是一个最佳实践/标准问题.这也可能适用于ul/ol.
我认为支持内部<a>
标签的唯一原因是:
I know they function the same, But it's a best practice/standards question. This could apply to ul/ol too.
The only reason I think to favor the <a>
tag inside is with a situation like:
<p>This is a longer sentence with a <a href=''>short link here</a></p>
谢谢!
推荐答案
第一个示例仅在HTML5中允许.
The first example is only allowed in HTML5.
第二个示例在所有版本的HTML/XHMTL中都是允许的.
The second example is allowed in all versions of HTML/XHMTL.
这篇关于HTML:< a>的正确顺序是什么?和< p>标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!