span

span 要素 (HTML)

[4] span 要素型は、 class 属性や id 属性と併用することで、 文書構造を与えるための一般的な仕組みとして用意されました。

span行内要素ではありますが、 それ以外に表現上の制約はありません。 著者は、スタイルシートlang 属性を使って要求を満たすことができます。

[13] 仕様書:

[5]

状態
W3C勧告
局所名
span (span (範囲) より)
名前空間URI
http://www.w3.org/1999/xhtml
開始タグ
必須
終了タグ
必須
内容モデル
(%inline;)*
出現できる文脈
%inline な文脈
属性
属性名属性値既定値説明状態出典
_moz_activated非標準Mozilla
_moz_anonclass非標準Mozilla
class[HTML4] %coreattr ⊂ %attrs
datafld欄名[HTML4] 予約
dataformatデータ書式[HTML4] 予約
datasrcデータ源[HTML4] 予約
dir書字方向[HTML4] %i18n ⊂ %attrs
editable非標準
editblock非標準
id一意識別子[HTML4] %coreattr ⊂ %attrs
lang自然言語[HTML4] %i18n ⊂ %attrs
xml:lang自然言語[XHTML1] %i18n ⊂ %attrs
_moz_activated非標準
onclick[HTML4] %events ⊂ %attrs
ondblclick[HTML4] %events ⊂ %attrs
onkeydown[HTML4] %events ⊂ %attrs
onkeypress[HTML4] %events ⊂ %attrs
onkeyup[HTML4] %events ⊂ %attrs
onmousedown[HTML4] %events ⊂ %attrs
onmousemove[HTML4] %events ⊂ %attrs
onmouseout[HTML4] %events ⊂ %attrs
onmouseover[HTML4] %events ⊂ %attrs
onmouseup[HTML4] %events ⊂ %attrs
_moz_quote非標準Mozilla
spellcheck非標準Firefox 2
styleスタイル情報[HTML4] %coreattr ⊂ %attrs
title注釈的題[HTML4] %coreattr ⊂ %attrs

不思議解釈

[19]

span要素とは文書構造に何も影響を与えない単なるタグです。

出典: ボックスのお話 - Webデザインの教科書 :: オシャレチップス http://oshare.chips.jp/m_magazine/html07.html#content (2005年4月付け、2005年4月現在)

そんなはずあるか。阿呆らしい。何の影響も与えないなら、 なぜそんなタグを書く必要がある?

[15] スタイル・シートで表現を指定する例

<HEAD>
 <TITLE>SPAN and Style Sheet Example</TITLE>
 <STYLE type="text/css">
  SPAN.sc-ex { font-variant: small-caps }
 </STYLE>
</HEAD>
<BODY>
  <P><SPAN class="sc-ex">The first</SPAN> few words of
  this paragraph are in small-caps.
</BODY>

(HTML 4 仕様書より、改)

この例では、段落の最初の数語を small capital で表示するように指示しています。

[16] >>15 のような構造の記述よりも表現の記述に近いマーク付けを行うことは好ましくないと考える人もいます。

関連

[1]span」が名前に入った属性として、次のものがあります。 (いずれも span 要素とは無関係です。)


[18] HTML からの派生かどうかは定かではありませんが、 コーパスのタグセットにも span 要素があり、汎用の行内要素相当の使われ方がされています。 <span type> 属性があります。 用途については script="" も参照。

歴史

[14] スタイル・シートを使うとおおよそどんな要素にもスタイルを指定できるのですが、 行内要素であることを除いては表現上の意味を持たない span 要素型は特に便利です。 特に class 属性や id 属性を使って、 HTML を無限に拡張できます。 HTML 4

[17] HTML 4 DTD の注釈 (参考) には generic language/style container (共通言語・様式包含子) と書かれています。

[21] Internationalization Tag Set (ITS) Version 1.0 (2007-04-03 18:11:18 +09:00 版)

[34] SMIL 3.0 smilText ( 版) http://www.w3.org/TR/2008/REC-SMIL3-20081201/smil-text.html#edef-span

[11] DTBook にもあります。

[35] Packaged Web Apps (Widgets) - Packaging and XML Configuration (Second Edition) ( ( 版)) http://w3c.github.com/packed-webapps/packaging/#the-span-element-and-its-attributes

[36] Internationalization Tag Set (ITS) Version 1.0 ( ( 版)) http://www.w3.org/TR/its/#its-conformance-1-4

[37] Internationalization Tag Set (ITS) Version 1.0 ( ( 版)) http://www.w3.org/TR/its/#selection-local

[2] Schematron にも span 要素があります。

[3] UIA mapping for span / issue #124 (jasonkiss著, ) https://github.com/w3c/html-aam/commit/c6f725eaead9a9fbd16f7e2bd9b5ce9601d284e6

[6] UIA mapping for span / issue #124 (jasonkiss著, ) https://github.com/w3c/html-aam/commit/c6f725eaead9a9fbd16f7e2bd9b5ce9601d284e6

[7] UIA mapping for <span> is incorrect · Issue #124 · w3c/html-aam () https://github.com/w3c/html-aam/issues/124

[8] UIA mapping for <span> is incorrect · Issue #124 · w3c/html-aam () https://github.com/w3c/html-aam/issues/124

[9] Revert "UIA mapping for span / issue #124" (jasonkiss著, ) https://github.com/w3c/html-aam/commit/95f567916898826c250886813cdfd1eb21f5b4ab

[10] UIA mapping for <span> is incorrect · Issue #124 · w3c/html-aam () https://github.com/w3c/html-aam/issues/124