Aby wyświetlić listę lub tabelę dozwolonych i nieobsługiwanych funkcji lub technik, użyj elementów class="compare-yes"
i class="compare-no"
. Aby porównać zatwierdzone i niezalecane podejścia, użyj class="compare-better"
i class="compare-worse"
.
Poniższe przykłady pokazują, jak te klasy wstawiają odpowiednie ikony i nadają styl tekstowi.
Niezalecane: wcięcie za pomocą tabulacji
(bad sample code)
<p><span class="compare-worse">Not recommended</span> — indent with tabs</p>
<pre class="prettyprint">
(bad sample code)
</pre>
Zalecane – wcięcie z użyciem spacji
(good sample code)
<p><span class="compare-better">Recommended</span> — indent with spaces</p>
<pre class="prettyprint">
(good sample code)
</pre>
Z tego przykładu dowiesz się, jak używać tych klas w tabeli porównawczej.
Na tych kartach znajdziesz kod źródłowy wersji podstawowej i wersji zgodnej z wytycznymi dotyczącymi dostępności tej przykładowej tabeli porównawczej.
Wersja zgodna z ułatwieniami dostępu jest potrzebna do obsługi technologii wspomagających, takich jak czytniki ekranu. W tej wersji każda komórka w tabeli zawiera pusty element <span>
z elementem aria-label
, który służy do wyświetlania pomocnego tekstu. Ponieważ tekst pomocy będzie dokumentował porównanie, możesz też dodać aria-hidden="true"
do nagłówków wierszy i kolumn.
Podstawowe
<table>
<tr>
<th>Resource Type</th>
<th><code>list</code></th>
<th><code>insert</code></th>
<th><code>update</code></th>
<th><code>delete</code></th>
</tr>
<tr>
<td><code>activity</code></td>
<td><span class="compare-yes"></span></td>
<td><span class="compare-yes"></span></td>
<td><span class="compare-no"></span></td>
<td><span class="compare-no"></span></td>
</tr>
<tr>
<td><code>channel</code></td>
<td><span class="compare-yes"></span></td>
<td><span class="compare-no"></span></td>
<td><span class="compare-no"></span></td>
<td><span class="compare-no"></span></td>
</tr>
<tr>
<td><code>channelBanner</code></td>
<td><span class="compare-no"></span></td>
<td><span class="compare-yes"></span></td>
<td><span class="compare-no"></span></td>
<td><span class="compare-no"></span></td>
</tr>
</table>
zgodność z ułatwieniami dostępu,
<table>
<tr aria-hidden="true">
<th>Resource Type</th>
<th><code>list</code></th>
<th><code>insert</code></th>
<th><code>update</code></th>
<th><code>delete</code></th>
</tr>
<tr>
<td aria-hidden="true"><code>activity</code></td>
<td><span aria-label="The activity resource type has a list method" class="compare-yes"></span></td>
<td><span aria-label="The activity resource type has an insert method" class="compare-yes"></span></td>
<td><span aria-label="The activity resource type does not have an update method" class="compare-no"></span></td>
<td><span aria-label="The activity resource type does not have a delete method" class="compare-no"></span></td>
</tr>
<tr>
<td aria-hidden="true"><code>channel</code></td>
<td><span aria-label="The channel resource type has a list method" class="compare-yes"></span></td>
<td><span aria-label="The channel resource type does not have an insert method" class="compare-no"></span></td>
<td><span aria-label="The channel resource type does not have an update method" class="compare-no"></span></td>
<td><span aria-label="The channel resource type does not have a delete method" class="compare-no"></span></td>
</tr>
<tr>
<td aria-hidden="true"><code>channelBanner</code></td>
<td><span aria-label="The channelBanner resource type does not have a list method" class="compare-no"></span></td>
<td><span aria-label="The channelBanner resource type has an insert method" class="compare-yes"></span></td>
<td><span aria-label="The channelBanner resource type does not have an update method" class="compare-no"></span></td>
<td><span aria-label="The channelBanner resource type does not have a delete method" class="compare-no"></span></td>
</tr>
</table>