1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
---
title: title
slug: Web/HTML/Global_attributes/title
tags:
- Global attributes
- HTML
- Reference
- Title
translation_of: Web/HTML/Global_attributes/title
---
<div>{{HTMLSidebar("Global_attributes")}}</div>
<p><span class="seoSummary"><strong><code>title</code></strong> <a href="/ja/docs/Web/HTML/Global_attributes">グローバル属性</a>は、要素に関するアドバイザリー情報を表すテキストを含みます。</span></p>
<div>{{EmbedInteractiveExample("pages/tabbed/attribute-title.html","tabbed-shorter")}}</div>
<div class="hidden">このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> をクローンしてプルリクエストを送信してください。</div>
<p>典型的な用途は以下の通りです。</p>
<ul>
<li>{{HTMLElement("iframe")}} 要素の支援技術のためのラベル付け</li>
<li>プログラム的に関連付けれた{{HTMLElement("input")}} 要素のためのラベルを、実際の {{HTMLElement("label")}} の代替として提供</li>
<li><a href="/ja/docs/Web/HTML/Element/table">データ表</a>内のコントロールのラベル付け</li>
</ul>
<p><code>title</code> 属性は {{HTMLElement("link")}}, {{HTMLElement("abbr")}}, {{HTMLElement("input")}}, {{HTMLElement("menuitem")}} の各要素において、追加の意味を持ちます。</p>
<h2 id="Multiline_titles" name="Multiline_titles">複数行のタイトル</h2>
<p><code>title</code> 属性は複数の行を含むことができます。それぞれの <code>U+000A LINE FEED</code> (<code>LF</code>) 文字が改行を表します。いくつか注意しなければならないのは、これが次のように二行にわたって描画されることです。</p>
<h3 id="HTML">HTML</h3>
<pre class="brush: html notranslate"><p>Newlines in <code>title</code> should be taken into account,
like <abbr title="This is a
multiline title">example</abbr>.</p></pre>
<h3 id="Result" name="Result">結果</h3>
<div>{{EmbedLiveSample('Multiline_titles')}}</div>
<h2 id="Title_attribute_inheritance" name="Title_attribute_inheritance">title 属性の継承</h2>
<p>要素に <code>title</code> 属性がない場合、属性値は親ノードから継承され、さらにそれはその親ノードから継承されるというようになります。</p>
<p>この属性が空文字列に設定されると、その祖先の <code>title</code> が関係なく、この要素のツールチップとして使用するべきではないことを意味します。</p>
<h3 id="HTML_2">HTML</h3>
<pre class="brush: html notranslate"><div title="CoolTip">
<p>Hovering here will show “CoolTip”.</p>
<p title="">Hovering here will show nothing.</p>
</div></pre>
<h3 id="Result_2" name="Result_2">結果</h3>
<div>{{EmbedLiveSample('Title_attribute_inheritance')}}</div>
<h2 id="Accessibility_concerns" name="Accessibility_concerns">アクセシビリティの考慮</h2>
<p><code>title</code> 属性を使用することは、次のような人々にとって大きな問題になります。</p>
<ul>
<li>タッチのみの機器を使用している人々</li>
<li>キーボードで操作している人々</li>
<li>読み上げソフトや拡大鏡などの支援技術で操作している人々</li>
<li>細かい運動制御障碍を経験している人々</li>
<li>認知障碍のある人</li>
</ul>
<p>これは、ブラウザーが表示するページを追加支援技術が解釈することによる複合性について、ブラウザーの互換性に一貫性がないためです。ツールチップ効果が必要であれば、上記の閲覧方法でもアクセスできる<a href="https://inclusive-components.design/tooltips-toggletips/">もっとアクセシブルな技術を使用する</a>方が効果的です。</p>
<ul>
<li><a href="https://www.w3.org/TR/html/dom.html#the-title-attribute">3.2.5.1. The title attribute | W3C HTML 5.2: 3. Semantics, structure, and APIs of HTML documents</a></li>
<li><a href="https://developer.paciellogroup.com/blog/2013/01/using-the-html-title-attribute-updated/">Using the HTML title attribute – updated | The Paciello Group</a></li>
<li><a href="https://inclusive-components.design/tooltips-toggletips/">Tooltips & Toggletips - Inclusive Components</a></li>
<li><a href="https://www.24a11y.com/2017/the-trials-and-tribulations-of-the-title-attribute/">The Trials and Tribulations of the Title Attribute - 24 Accessibility</a></li>
</ul>
<h2 id="Specifications" name="Specifications">仕様書</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">仕様書</th>
<th scope="col">状態</th>
<th scope="col">備考</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', "dom.html#the-title-attribute", "title")}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td>最新のスナップショットである {{SpecName('HTML5.1')}} から変更なし。</td>
</tr>
<tr>
<td>{{SpecName('HTML5.1', "dom.html#the-title-attribute", "title")}}</td>
<td>{{Spec2('HTML5.1')}}</td>
<td>{{SpecName('HTML WHATWG')}} のスナップショットであり、{{SpecName('HTML5 W3C')}} から変更なし。</td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', "dom.html#the-title-attribute", "title")}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td>{{SpecName('HTML WHATWG')}} のスナップショット。 {{SpecName("HTML4.01")}} から、真にグローバルな属性になりました。</td>
</tr>
<tr>
<td>{{SpecName('HTML4.01', 'struct/global.html#adef-title', 'title')}}</td>
<td>{{Spec2('HTML4.01')}}</td>
<td>{{HTMLElement("base")}}, {{HTMLElement("basefont")}}, {{HTMLElement("head")}}, {{HTMLElement("html")}}, {{HTMLElement("meta")}}, {{HTMLElement("param")}}, {{HTMLElement("script")}}, {{HTMLElement("title")}} を除くすべての要素で対応。</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>
<p>{{Compat("html.global_attributes.title")}}</p>
<h2 id="See_also" name="See_also">関連情報</h2>
<ul>
<li>すべての <a href="/ja/docs/Web/HTML/Global_attributes">グローバル属性</a>。</li>
<li>{{domxref("HTMLElement.title")}} は、この属性を反映します。</li>
</ul>
|