User:靜音未來/沙盒/3

User:靜音未來/沙盒/3/中文 https://developer.mozilla.org/en-US/docs/Web/HTML/Element/span MDN

Jump to:

1. Attributes 2. Example 1 3. Example 2 4. Specifications 5. Browser compatibility 6. See also

The 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 orid attributes), or because they share attribute values, such as lang. It should be used only when no other semantic element is appropriate. is very much like a
element, but
is a block-level element whereas a is an inline element.

Content categories Flow content,phrasing content. Permitted content Phrasing content

Tag omission None, both the starting and ending tag are mandatory.

Permitted parents

Any element that accepts phrasing content,or any element that accepts flow content. Permitted ARIA roles Any

DOM interface

HTMLSpanElement (before HTML 5, the interface was HTMLElement)

Attributes

This element only includes the global attributes.

Example 1

Some text

Result

Some text

Example 2

  • <a href="portfolio.html" target="_blank">See my portfolio</a>
  • CSS: li span { background: gold; } Specifications Specification Status Comment HTML Living Standard The definition of '' in that specification. Living Standard HTML5 The definition of '' in that specification. Recommendation The DOM interface is now HTMLSpanElement. HTML 4.01 Specification The definition of '' in that specification. Recommendation Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. Desktop Mobile Feature Chrome Edge Firefox Internet Explorer Opera Safari Basic support Yes Yes 1 Yes Yes Yes Feature Android webview Chrome for Android Edge mobile Firefox for Android Opera Android iOS Safari Samsung Internet Basic support Yes Yes Yes 4 Yes Yes ? Desktop Mobile Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet Basic support Full support Yes Full support Yes Full support 1 Full support Yes Full support Yes Full support Yes Full support Yes Full support Yes Full support Yes Full support 4 Full support Yes Full support Yes ? Legend Full support Full support Compatibility unknown Compatibility unknown See also HTML
    element