<a> 中可以包含哪些元素?标签? [英] What elements can be contained within a <a> tag?

查看:35
本文介绍了<a> 中可以包含哪些元素?标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些有效的 html 元素(如果有)可以包含在 标签中?

What are the valid html elements, if any, that can be contained within a <a> tag?

推荐答案

内联元素( a, span, strong, em 等)可以包含其他内联元素和文本节点.锚点可以包含跨度,跨度可以包含文本节点.

Inline elements ( a, span, strong, em among others ) can contain other inline elements and text nodes. An anchor can contain a span, which can contain a text node.

一般来说,块级元素可以包含内联元素和其他块级元素.一般来说,内联元素可能只包含数据和其他内联元素.本质上这种结构上的区别是块元素创建的想法比内联更大"的结构元素.

Generally, block-level elements may contain inline elements and other block-level elements. Generally, inline elements may contain only data and other inline elements. Inherent in this structural distinction is the idea that block elements create "larger" structures than inline elements.

来自 http://www.w3.org/TR/html401/struct/global.html

如其他答案所述,您不能在 a 中嵌套 a.

As noted in other answers, you can't nest an a in an a.

这篇关于&lt;a&gt; 中可以包含哪些元素?标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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