We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS

这篇翻译不完整。请帮忙从英语翻译这篇文章

概要

HTML <span> 元素是短语内容的通用行内容器,并没有任何特殊语义。可以使用它来编组元素以达到某种样式意图(通过使用类或者Id属性),或者这些元素有着共同的属性,比如lang。应该在没有其他合适的语义元素时才使用它。<span> 与 <div> 元素很相似,但 <div> 是一个 块元素<span> 则是 行内元素 .

属性

该元素仅包含 全局属性

例 1

<p><span>Some text</span></p>

结果

Some text

 

例 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 Standard
<span>
Living Standard  
HTML5
<span>
Recommendation The DOM interface is now HTMLSpanElement.
HTML 4.01 Specification
<span>
Recommendation  

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help!

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support (Yes) (Yes) (Yes) (Yes) (Yes)

 

参见

文档标签和贡献者

标签: 
此页面的贡献者: OlafCheng, King., Fadeoc
最后编辑者: OlafCheng,