<span>: The Content Span element
<span>
HTML 元素是用于措辞内容的通用内联容器,其本身并不代表任何内容。它可用于出于样式目的对元素进行分组(使用 class
或 id
属性),或者因为它们共享属性值,例如 lang
。仅当没有其他语义元素合适时才应使用它。<span>
非常类似于 <div>
元素,但 <div>
是 块级元素,而 <span>
是 行内元素。
¥The <span>
HTML element is a generic inline container for phrasing content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class
or id
attributes), or because they share attribute values, such as lang
. It should be used only when no other semantic element is appropriate. <span>
is very much like a <div>
element, but <div>
is a block-level element whereas a <span>
is an inline-level element.
Try it
属性
示例
实现例 1
实现例 2
技术总结
规范
Specification |
---|
HTML Standard # the-span-element |
浏览器兼容性
BCD tables only load in the browser
也可以看看
¥See also
- HTML
<div>
元素