html链接正确的位置? [英] html link correct placement?
本文介绍了html链接正确的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常是html链接:
<p><a href="#">this is link</a></p>
<h1><a href="#">this is link</a></h1>
<span><a href="#">this is link</a></span>
href链接是否可以像这样包装在其他元素之外?
Can a href link wrap outside of other element like so?
<a href="#"><p>this is link</p></a>
<a href="#"><h1>this is link</h1></a>
<a href="#"><span>this is link</span></a>
而且在div之外?
<a href="#">
<div>this is div
<p>here is the paragraph</p>
<div>and nested div</div>
</div>
</a>
推荐答案
是.规范中< a>
没有任何禁止"元素(标准的< html>
,< body>
,< head>
,< title>
,< meta>
...).< a>
链接,每个人都应该被链接.
Yes. There isn't any "prohibited" elements for <a>
in the spec (except for the standard <html>
, <body>
, <head>
, <title>
, <meta>
...). <a>
links, and everyone deserves to be linked.
请记住< a>
是内联的,因此您必须设置 display:block
才能像< div>
Keep in mind tho that <a>
is inline, so you will have to set display: block
to use it like <div>
这篇关于html链接正确的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文