span
内容类别 |
Flow content, phrasing content. |
---|---|
允许的内容 |
Phrasing content |
标记遗漏 | 没有,起始和结束标签都是强制性的。 |
允许父级 | 任何接受短语内容的元素,或任何接受流内容的元素。 |
允许ARIA角色 | 任何 |
DOM界面 | HTMLSpanElement(在HTML 5之前,界面是HTMLElement) |
属性
这个元素只包含全局属性。
Example 1
<p><span>Some text</span></p>
Result
Some text
Example 2
<li><span>
<a href="portfolio.html" target="_blank">See my portfolio</a>
</span></li>
CSS:
li span {
background: gold;
}
规范
Specification | Status | Comment |
---|---|---|
HTML Living StandardThe definition of '<span>' in that specification. | Living Standard | |
HTML5The definition of '<span>' in that specification. | Recommendation | The DOM interface is now HTMLSpanElement. |
HTML 4.01 SpecificationThe definition of '<span>' in that specification. | Recommendation | |
浏览器兼容性
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | 1 | (Yes) | (Yes) | (Yes) |
Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support | (Yes) | (Yes) | (Yes) | 1 | (Yes) | (Yes) | (Yes) |
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com