在HTML中,应该< a />和< h1 />嵌套? [英] In HTML which way round should <a/> and <h1/> be nested?
本文介绍了在HTML中,应该< a />和< h1 />嵌套?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在HTML中嵌套< a>
和< h1>
元素的顺序是否正确?
例如:
< a href =www。 example.com>< H1物实施例<!/ H1>< / A>
或
< h1>< a href =www.example.com>示例!< / a>< / h1>
解决方案
在HTML 4.01和XHTML 1.1及更高版本中:
-
h1
可能包含a $ c $
$a
may not 包含h1 $ c $ lt; code>< h1>< a> ...< / a>< / li>
< h1>
在HTML 5的草稿中:
-
h1
可能包含a
-
a
可能包含h1
(但只有当a
在某个地方h1
是允许的 - 请参阅此答案的评论)
浏览器的支持可能会有所不同(这就是生命的最前沿)。
Is there a more correct order for nesting a
<a>
and<h1>
elements in HTML?e.g.:
<a href="www.example.com"><h1>Example!</h1></a>
or
<h1><a href="www.example.com">Example!</a></h1>
解决方案In HTML 4.01 and XHTML 1.1 and older:
- An
h1
may contain ana
- An
a
may not contain anh1
So
<h1><a>…</a></h1>
In the HTML 5 draft:
- An
h1
may contain ana
- An
a
may contain anh1
(but only if thea
is somewhere anh1
is allowed — see the comments on this answer)
So either, but browser support may vary (such is life on the bleeding edge).
这篇关于在HTML中,应该< a />和< h1 />嵌套?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
-
查看全文