You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: css-content/Overview.bs
+42-40Lines changed: 42 additions & 40 deletions
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,48 @@ Issue: should the contents keyword be replaced with ''content()''
132
132
133
133
134
134
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
+
135
177
<h2 id="content-functions">
136
178
Content Values and Functions</h2>
137
179
@@ -929,46 +971,6 @@ Automatic counters and numbering: the 'counter-increment' and 'counter-reset' pr
929
971
930
972
931
973
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".
0 commit comments