超链接内的超链接 [英] Hyperlink within hyperlink

查看:131
本文介绍了超链接内的超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能是一个愚蠢的问题,但我希望有一个超链接与另一个超链接,就像

 < a href =#somewhere> 
这是超链接,
< a href =somewhere_else.html>这是另一个< / a>
< / a>

除此之外,它不符合所有规定,是否有这种方法?



*编辑:旋转木马使用外部超链接,并且不会将浏览器带到某个地方。

解决方案

锚点标签,就像内联或块级别元素一样,在嵌套时层叠在彼此的顶部,以便可以为其中的不同信息子集或视觉空间设置属性。这可能是有用的,如果你有一个大的锚点元素作为一个大按钮,但要插入一个链接到该按钮内的其他位置。



您是否尝试过实施它?请参阅此 jsFiddle ,证明嵌套内联元素可以使用span和anchor标签。请注意,嵌套元素会覆盖父元素内的可点击区域子集,就像您期待它收听悬停事件一样。

免责声明:虽然技术上可以这样做,但这并不意味着它应该完成。特别是嵌套链接可能会导致用户混淆,并误导有哪些内容指向哪些位置。


Probably a silly questions, but I'd like to have a hyperlink withing another hyperlink, much like a

<a href="#somewhere">
  This is the hyperlink,
  <a href="somewhere_else.html">and this is the other one</a>
</a>

Aside from that it's not compliant and all, is there a way of doing this?

*Edit: the outer hyperlink is used by a carousel, and won't take the browser somewhere.

解决方案

Anchor tags, just like inline or block level elements, layer up on top of each other when nested such that attributes can be set for different subsets of information or visual space within them. This may be useful if you have a large anchor element functioning as a large button, but want to insert a link to a different location within that button.

Have you tried implementing it? See this jsFiddle proving that nested inline elements work, both with span and anchor tags. Note that the nested element overrides the clickable area subset within the parent element, just as you'd expect it to if you were listening for a hover event.

Disclaimer: While technically this can be done, that doesn't mean that it should be done. Nesting links in particular can result in user confusion and be misleading about what content is pointing to what locations.

这篇关于超链接内的超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆