嵌套 HTML- 锚标记
今天我正在研究网页的选项卡导航。 我尝试了滑动门方法,效果很好。 然后我意识到我必须包含一个删除选项卡的选项(通常是每个选项卡右上角的小 X)。
我想使用嵌套锚点,但它不起作用,因为它是 不允许。 然后我在 Pageflakes 上看到了选项卡导航,它实际上正在工作(包括嵌套超链接)。 为什么?
Today I was working on a tab navigation for a webpage. I tried the Sliding Doors approach which worked fine. Then I realized that I must include an option to delete a tab (usually a small X in the right corner of each tab).
I wanted to use a nested anchor, which didn't work because it is not allowed. Then I saw the tab- navigation at Pageflakes, which was actually working (including nested hyperlinks). Why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我怀疑嵌套链接是否工作可能取决于您的浏览器是否以严格模式(例如 XHTML DTD、application/xml+html MIMEtype)或“怪异”模式呈现页面。
I suspect that working or not working nested links might depend if your browser renders page in strict mode (e.g. XHTML DTD, application/xml+html MIMEtype), or in "quirks" mode.
尽管嵌套标签是非法的,但使用 JS 编写它们是可行的!,试试这个:
In spite of nested tags are illegal but writing them using JS will work!, try this:
他们必须用 JavaScript 做一些非常疯狂的事情才能让它工作(注意父锚标记和嵌套锚标记都没有名称或 href 属性 - 所有功能都是通过类名称和 JS 完成的)。
html 的样子如下:
They must be doing some really crazy stuff with JavaScript to get it to work (notice how neither the parent nor the nested anchor tags have a name or href attribute - all functionality is done through the class name and JS).
Here is what the html looks like:
实际上,我之前粘贴的代码是经过所有 JS 操作后生成的 DOM。 如果您没有适用于 Firefox 的 Firebug 扩展程序,您应该立即获取。
编辑:删除旧帖子,不再有用。 Firebug 是,所以这个留下来:)
Actually, the code I had pasted previously was the generated DOM, after all JS manipulation. If you don't have the Firebug extension for Firefox, you should get it now.
Edit: Deleted the old post, it was no longer useful. Firebug is, so this one is staying :)
嵌套链接非法
Nested links are illegal