您是否允许在链接内嵌入链接? [英] Are you allowed to nest a link inside of a link?
问题描述
这看起来很基本,你是否允许在链接里面放一个链接?请参阅下面的附图:
我试图让整个灰色栏可点击去某个地方,但如果用户点击滚轮或移动箭头,它们是其他链接。查看我当前的代码:
< a href =#class =sp_mngt_bar>
< h1><?php echo $ v; ?>< / h1>
< a href =#class =t_icons t_icons_settings sp_mngt_settings>< / a>
< a href =#class =t_icons t_icons_move sp_mngt_move>< / a>
< / a>
这是一个好习惯吗?我做错了吗?你会怎么做呢?
p>
12.2.2嵌套链接是非法的
由A元素定义的链接和锚点不能嵌套; A元素不能包含任何其他A元素。
由于DTD将LINK元素定义为空,因此LINK元素也不能嵌套。
HTML 5
并且对于 HTML5略有不同。
您不能拥有互动内容。 互动式内容包含锚定标签。
This may seem pretty basic, are you allowed to put a link inside of a link? See attached image below:
I'm trying to have the whole grey bar clickable to go somewhere, but if the user clicks the wheel or the move arrow, they are other links. See my current code:
<a href="#" class="sp_mngt_bar">
<h1><?php echo $v; ?></h1>
<a href="#" class="t_icons t_icons_settings sp_mngt_settings"></a>
<a href="#" class="t_icons t_icons_move sp_mngt_move"></a>
</a>
Is this a good practice? Am I doing it wrong? How would you do this? Thanks for the help!
Straight from the W3C for HTML4:
12.2.2 Nested links are illegal
Links and anchors defined by the A element must not be nested; an A element must not contain any other A elements.
Since the DTD defines the LINK element to be empty, LINK elements may not be nested either.
HTML 5
And for HTML5 it is a little different.
You cannot have Interactive Content inside an A element. Interactive Content includes anchor tags.
这篇关于您是否允许在链接内嵌入链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!