Skip to content

Commit ad459c0

Browse files
committed
Updating CSS for C7
1 parent a5d99bb commit ad459c0

1 file changed

Lines changed: 61 additions & 67 deletions

File tree

‎techniques/css/C7.html‎

Lines changed: 61 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,77 @@
1-
<!DOCTYPE html><html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><title>Using CSS to hide a portion of the link text </title><link rel="stylesheet" type="text/css" href="../../css/sources.css" class="remove"></link></head><body><h1>Using CSS to hide a portion of the link text </h1><section class="meta"><p class="id">ID: C7</p><p class="technology">Technology: css</p><p class="type">Type: Technique</p></section><section id="applicability"><h2>When to Use</h2>
1+
<!DOCTYPE html>
2+
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<title>Using CSS to hide a portion of the link text </title>
5+
<link rel="stylesheet" type="text/css" href="../../css/sources.css" class="remove"></link>
6+
</head>
7+
<body>
8+
<h1>Using CSS to hide a portion of the link text</h1>
9+
<section class="meta">
10+
<p class="id">ID: C7</p>
11+
<p class="technology">Technology: css</p>
12+
<p class="type">Type: Technique</p>
13+
</section>
14+
<section id="applicability">
15+
<h2>When to Use</h2>
216
<p>All technologies that support CSS .</p>
3-
</section><section id="description"><h2>Description</h2>
17+
</section>
18+
<section id="description"><h2>Description</h2>
419
<p>The objective of this technique is to supplement the link text by adding additional text that describes the unique function of the link and styling the additional text so that it is not rendered on the screen by user agents that support CSS. When information in the surrounding context is needed to interpret the displayed link text, this technique provides a complete description of the link's input function while permitting the less complete text to be displayed.</p>
5-
<p>This technique works by creating a CSS selector to target text that is to be hidden. The rule set for the selector places the text to be hidden in a 1-pixel box with overflow hidden, and positions the text outside of the viewport. This ensures the text does not display on screen but remains accessible to assistive technologies such as screen readers and braille displays. Note that the technique does not use visibility:hidden or display:none properties, since these can have the unintentional effect of hiding the text from assistive technology in addition to preventing on-screen display.</p>
20+
<p>This technique works by creating a CSS selector to target text that is to be hidden. The rule set for the selector places the text to be hidden in a 1-pixel box with overflow hidden. This ensures the text does not display on screen but remains accessible to assistive technologies such as screen readers and braille displays. Note that the technique does not use visibility:hidden or display:none properties, since these can have the unintentional effect of hiding the text from assistive technology in addition to preventing on-screen display.</p>
21+
<p>This technique is <strong>not</strong> a method for hiding complete links, only a section of text within a link. The <a href="#resources">resources</a> below include methods for hiding and showing links aimed at screenreader users.</p>
622
<div class="note">
723
<p>This technique to hide link text has been advocated by some screen reader users and corporate Web authors. It has proved effective on some Web sites. Other screen reader users and accessibility experts don't recommend this as a general technique because the results can be overly chatty and constrain the ability of the experienced screen reader user to control the verbosity. The working group believes the technique can be useful for Web pages that do not have repetitive content in the hidden text areas.</p>
824
<p>This technique can be used in combination with a style switching technique to present a page that is a <a>conforming alternate version</a> for non-conforming content. Refer to <a href="#C29"></a> and <a href="https://www.w3.org/WAI/WCAG21/Understanding/conformance#conforming-alt-versions">Understanding Conforming Alternate Versions</a> for more information. </p>
925
</div>
10-
</section><section id="examples"><h2>Examples</h2>
26+
</section>
27+
<section id="examples">
28+
<h2>Examples</h2>
1129
<p>The following examples use the CSS selector and rule set below:</p>
12-
<pre><code>a span {
13-
height: 1px;
14-
width: 1px;
15-
position: absolute;
16-
overflow: hidden;
17-
top: -10px;
30+
<pre><code>.visually-hidden {
31+
clip-path: inset(100%);
32+
clip: rect(1px, 1px, 1px, 1px);
33+
height: 1px;
34+
overflow: hidden;
35+
position: absolute;
36+
white-space: nowrap;
37+
width: 1px;
1838
}</code></pre>
1939

2040
<section class="example">
2141

2242
<p>This example describes a news site that has a series of short synopsis of stories followed by a link that says "full story". Hidden link text describes the purpose of the link.</p>
2343

24-
<pre xml:space="preserve">
25-
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
26-
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
27-
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
28-
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
29-
&lt;head&gt;
30-
&lt;meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" /&gt;
31-
&lt;link href="access.css" rel="stylesheet" type="text/css" /&gt;
32-
&lt;title&gt;Hidden Link Text&lt;/title&gt;
33-
&lt;/head&gt;
34-
&lt;body&gt;
44+
<pre><code>
3545
&lt;p&gt;Washington has announced plans to stimulate economic growth.
36-
&lt;a href="#"&gt; &lt;span&gt;Washington stimulates economic growth &lt;/span&gt;
37-
Full Story&lt;/a&gt;&lt;/p&gt;
38-
&lt;/body&gt;
39-
&lt;/html&gt;
40-
</pre>
46+
&lt;a href="#"&gt;&lt;span class="visually-hidden"&gt;Washington stimulates economic growth &lt;/span&gt;
47+
Full Story&lt;/a&gt;&lt;/p&gt;</code></pre>
4148
</section>
4249
<section class="example">
4350

44-
<p>This example describes a resource that has electronic books in different formats. The title of each book is followed by links that say "HTML" and "PDF." Hidden text describes the purpose of each link.</p>
51+
<p>This example describes a resource that has electronic books in different formats. The title of each book is followed by links that say "HTML" and "PDF." Hidden text describes the purpose of each link.</p>
4552

46-
<pre xml:space="preserve">
47-
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
48-
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
49-
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
50-
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
51-
&lt;head&gt;
52-
&lt;meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" /&gt;
53-
&lt;link href="access.css" rel="stylesheet" type="text/css" /&gt;
54-
&lt;title&gt;Hidden Link Text &lt;/title&gt;
55-
&lt;/head&gt;
56-
&lt;body&gt;
57-
&lt;dl&gt;
53+
<pre><code>&lt;dl&gt;
5854
&lt;dt&gt;Winnie the Pooh &lt;/dt&gt;
5955
&lt;dd&gt;&lt;a href="winnie_the_pooh.html"&gt;
60-
&lt;span&gt;Winnie the Pooh &lt;/span&gt;HTML&lt;/a&gt;&lt;/dd&gt;
56+
&lt;spann class="visually-hidden"&gt;Winnie the Pooh &lt;/span&gt;HTML&lt;/a&gt;&lt;/dd&gt;
6157
&lt;dd&gt;&lt;a href="winnie_the_pooh.pdf"&gt;
62-
&lt;span&gt;Winnie the Pooh &lt;/span&gt;PDF&lt;/a&gt;&lt;/dd&gt;
58+
&lt;spann class="visually-hidden"&gt;Winnie the Pooh &lt;/span&gt;PDF&lt;/a&gt;&lt;/dd&gt;
6359
&lt;dt&gt;War and Peace&lt;/dt&gt;
6460
&lt;dd&gt;&lt;a href="war_and_peace.html"&gt;
65-
&lt;span&gt;War and Peace &lt;/span&gt;HTML&lt;/a&gt;&lt;/dd&gt;
61+
&lt;spann class="visually-hidden"&gt;War and Peace &lt;/span&gt;HTML&lt;/a&gt;&lt;/dd&gt;
6662
&lt;dd&gt;&lt;a href="war_and_peace.pdf"&gt;
67-
&lt;span&gt;War and Peace &lt;/span&gt;PDF&lt;/a&gt;&lt;/dd&gt;
68-
&lt;/dl&gt;
69-
&lt;/body&gt;
70-
&lt;/html&gt;
71-
</pre>
63+
&lt;spann class="visually-hidden"&gt;War and Peace &lt;/span&gt;PDF&lt;/a&gt;&lt;/dd&gt;
64+
&lt;/dl&gt;</code></pre>
65+
7266
</section>
73-
</section><section id="tests"><h2>Tests</h2>
67+
</section>
68+
<section id="tests">
69+
<h2>Tests</h2>
7470
<section class="procedure"><h3>Procedure</h3>
75-
<p>For each anchor element using this technique:
76-
</p>
71+
<p>For each anchor element using this technique:</p>
7772
<ol>
78-
<li>Check that an element has been defined that confines its display to a pixel and positions text outside the display with overflow hidden</li>
79-
<li>Check that the element of that class is included in the content of the anchor
80-
</li>
73+
<li>Check that an element has been defined that confines its display to a pixel and hides the text</li>
74+
<li>Check that the element of that class is included in the content of the anchor</li>
8175
<li>Check that the combined content of the anchor describes the purpose of the link</li>
8276
</ol>
8377
</section>
@@ -86,19 +80,19 @@
8680
<li>All checks above are true.</li>
8781
</ul>
8882
</section>
89-
</section><section id="related"><h2>Related Techniques</h2><ul>
90-
<li><a href="../general/G91">G91</a></li>
91-
92-
<li><a href="../html/H33">H33</a></li>
93-
</ul></section><section id="resources"><h2>Resources</h2>
94-
83+
</section>
84+
<section id="related"><h2>Related Techniques</h2>
85+
<ul>
86+
<li><a href="../general/G91">G91</a></li>
87+
<li><a href="../html/H33">H33</a></li>
88+
</ul>
89+
</section>
90+
<section id="resources">
91+
<h2>Resources</h2>
9592
<ul>
96-
<li>
97-
<a href="http://www.rnib.org.uk/blogs/expert-series?Name=Hidden%20barriers">Hidden barriers - out of sight</a>
98-
</li>
99-
<li>
100-
<a href="http://webaim.org/techniques/css/invisiblecontent/">CSS in Action: Invisible Content Just for Screen Reader Users</a>
101-
</li>
93+
<li><a href="https://developer.paciellogroup.com/blog/2012/05/html5-accessibility-chops-hidden-and-aria-hidden/">HTML5 Accessibility Chops: hidden and aria-hidden</a></li>
94+
<li><a href="http://webaim.org/techniques/css/invisiblecontent/">CSS in Action: Invisible Content Just for Screen Reader Users</a></li>
10295
</ul>
103-
104-
</section></body></html>
96+
</section>
97+
</body>
98+
</html>

0 commit comments

Comments
 (0)