aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/html/element/details/index.html
blob: bbc3bc41beaa249621e20fe204ab45675ffe2373 (plain)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
---
title: <details>
slug: Web/HTML/Element/details
tags:
  - Element
  - HTML
  - HTML interactive elements
  - Reference
  - Web
  - details
translation_of: Web/HTML/Element/details
---
<div>{{HTMLRef}}</div>

<p>HTML-элемент<strong> <code>&lt;details&gt;</code></strong> используется для раскрытия скрытой (дополнительной) информации.</p>

<p>Виджет раскрытия обычно представлен на экране с использованием небольшого треугольника, который поворачивается, чтобы показать состояние открытия / закрытия, с меткой рядом с треугольником. Если первый дочерний элемент элемента <code>&lt;details&gt; </code>является <code>&lt;summary&gt;</code>, содержимое элемента <code>&lt;summary&gt;</code> используется в качестве метки для виджета раскрытия.</p>

<p>{{EmbedInteractiveExample("pages/tabbed/details.html", "tabbed-standard")}}</p>

<p> </p>

<table class="properties">
 <tbody>
  <tr>
   <th scope="row"><a href="/en-US/docs/Web/HTML/Content_categories">Content categories</a></th>
   <td><a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">Flow content</a>, sectioning root, interactive content, palpable content.</td>
  </tr>
  <tr>
   <th scope="row">Permitted content</th>
   <td>One {{HTMLElement("summary")}} element followed by <a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">flow content</a>.</td>
  </tr>
  <tr>
   <th scope="row">Tag omission</th>
   <td>{{no_tag_omission}}</td>
  </tr>
  <tr>
   <th scope="row">Permitted parents</th>
   <td>Any element that accepts <a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">flow content</a>.</td>
  </tr>
  <tr>
   <th scope="row">Permitted ARIA roles</th>
   <td>None</td>
  </tr>
  <tr>
   <th scope="row">DOM interface</th>
   <td>{{domxref("HTMLDetailsElement")}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Атрибуты">Атрибуты</h2>

<p>Элемент поддерживает только <a href="/en-US/docs/Web/HTML/Global_attributes">глобальные атрибуты</a>.</p>

<dl>
 <dt>{{htmlattrdef("open")}}</dt>
 <dd>Данный логический атрибут указывает, будет ли дополнительная информация отображаться пользователю при загрузке страницы. По умолчанию установлено значение false, поэтому дополнительная информация будет скрыта.</dd>
</dl>

<h2 id="Пример">Пример</h2>

<pre class="brush: html">&lt;details&gt;
  &lt;summary&gt;Some details&lt;/summary&gt;
  &lt;p&gt;More info about the details.&lt;/p&gt;
&lt;/details&gt;

&lt;details open&gt;
  &lt;summary&gt;Even more details&lt;/summary&gt;
  &lt;p&gt;Here are even more details about the details.&lt;/p&gt;
&lt;/details&gt;
</pre>

<h3 id="Result">Result</h3>

<p>{{EmbedLiveSample("Example")}}</p>

<div class="note">
<p><strong>Примечание: </strong>Если приведённый выше пример не работает, см. {{anch("Browser compatibility")}} , чтобы определить поддерживает ли вообще ваш браузер эту функцию. </p>
</div>

<h2 id="Примеры_стилизации">Примеры стилизации</h2>

<p>Следуя более новой спецификации, Firefox отображает элемент summary как <code>display: list-item</code>  и маркер можно стилизовать так же, как и элементы списка.</p>

<p>Следуя более старой спецификации, в Chrome and Safari существует пользовательский псевдо-элемент <code>::-webkit-details-marker</code>, с помощью которого можно стилизовать маркер. </p>

<p>Для кроссбраузерной стилизации маркера, чтобы скрыть дефолтный и добавить кастомный, необходимо для Firefox установить элементу <code>summary {display: block;}, а для </code>Chrome и Safari's установить <code>::-webkit-details-marker {display: none;}</code>. После этого дефолтный маркер будет скрыт, после чего можно установить свой маркер любым доступным способом стилизации. В примере ниже с помощью псевдоэлементов маркер возвращается обратно.  </p>

<h3 id="HTML">HTML</h3>

<pre class="brush: html">&lt;details&gt;
  &lt;summary&gt;Some details&lt;/summary&gt;
  &lt;p&gt;More info about the details.&lt;/p&gt;
&lt;/details&gt;</pre>

<h3 id="CSS">CSS</h3>

<pre class="brush: css">summary {
  display: block;
}

  summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: '\25B6';
  padding-right: 0.5em;
}

details[open] &gt; summary::before {
  content: '\25BC';
}
</pre>

<h3 id="Result_2">Result</h3>

<p>{{ EmbedLiveSample('Example_with_styling') }}</p>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('HTML WHATWG', 'forms.html#the-details-element', '&lt;details&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5.1', 'semantics.html#the-details-element', '&lt;details&gt;')}}</td>
   <td>{{Spec2('HTML5.1')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Edge</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>12</td>
   <td><a href="https://developer.microsoft.com/en-us/microsoft-edge/platform/status/detailssummary?filter=f3f0000bf&amp;search=details">In Development</a></td>
   <td>{{CompatGeckoDesktop("49.0")}}</td>
   <td>{{CompatNo}}</td>
   <td>15</td>
   <td>6</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Edge</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>4.0</td>
   <td><a href="https://developer.microsoft.com/en-us/microsoft-edge/platform/status/detailssummary?filter=f3f0000bf&amp;search=details">In Development</a></td>
   <td>{{CompatGeckoMobile("49.0")}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>6.1</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{HTMLElement("summary")}}</li>
</ul>