Skip to content

Commit 5a1c272

Browse files
committed
[css-content] update examples from css-pseudo to use new version of alt
1 parent d180b3c commit 5a1c272

File tree

1 file changed

+42
-40
lines changed

1 file changed

+42
-40
lines changed

css-content/Overview.bs

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,48 @@ Issue: should the contents keyword be replaced with ''content()''
132132

133133

134134

135+
Generated content often needs alternative text.
136+
If the value of the content property is a string,
137+
this string should be used by assistive technology
138+
unless an alternative is provided. This allows
139+
purely decorative text to be ignored by providing
140+
the empty string as alternative text.
141+
Appropriate alternative text must be provided for
142+
images inserted via the content property as well.
143+
144+
145+
<!--examples from CSS-PSEUDO, redone with our new syntax-->
146+
147+
<div class="example">
148+
Here the content property is an image, so the alt value is required to provide alternative text.
149+
150+
<pre>
151+
.new::before {
152+
content: url(./img/star.png) / "New!";
153+
/* or a localized attribute from the DOM: attr("data-alt") */
154+
}
155+
</pre>
156+
</div>
157+
158+
<div class="example">
159+
If the pseudo-element is purely decorative and its function is covered elsewhere, setting alt to the empty string can avoid reading out the decorative element. Here the ARIA attribute will be spoken as "collapsed". Without the empty string alt value, the content would also be spoken as "Black right-pointing pointer".
160+
161+
<pre>
162+
.expandable::before {
163+
content: "\25BA" / "";
164+
/* a.k.a. ► */
165+
/* aria-expanded="false" already in DOM,
166+
so this pseudo-element is decorative */
167+
}
168+
</pre>
169+
</div>
170+
171+
<!--end copy from CSS-PSEUDO-->
172+
173+
174+
175+
176+
135177
<h2 id="content-functions">
136178
Content Values and Functions</h2>
137179

@@ -929,46 +971,6 @@ Automatic counters and numbering: the 'counter-increment' and 'counter-reset' pr
929971

930972

931973

932-
<!--find home for examples-->
933-
934-
935-
<div class="example">
936-
Here the content property is an image, so the alt property is required to provide alternative text.
937-
938-
<pre>
939-
.new::before {
940-
content: url(./img/star.png);
941-
alt: "New!"; /* or a localized attribute from the DOM: attr("data-alt") */
942-
}
943-
</pre>
944-
</div>
945-
946-
<div class="example">
947-
If the pseudo-element is purely decorative and its function is covered elsewhere, setting alt to the empty string can avoid reading out the decorative element. Here the ARIA attribute will be spoken as "collapsed". Without the empty string alt value, the content would also be spoken as "Black right-pointing pointer".
948-
949-
<pre>
950-
.expandable::before {
951-
content: "\25BA"; /* a.k.a. ► */
952-
alt: "";
953-
/* aria-expanded="false" already in DOM,
954-
so this pseudo-element is decorative */
955-
}
956-
</pre>
957-
</div>
958-
959-
<!--end copy from CSS-PSEUDO-->
960-
961-
962-
963-
964-
965-
966-
967-
968-
969-
970-
971-
972974
<h2 id="css-bookmarks">
973975
Bookmarks
974976
</h2>

0 commit comments

Comments
 (0)