Skip to content

Добавляет visually-hidden #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions html-css.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ <h3>CSS</h3>
<li><a href="#css-class-names">Имена классов</a></li>
<li><a href="#css-import">Правило @import</a></li>
<li><a href="#css-font-variant">Варианты шрифта</a></li>
<li><a href="#css-visually-hidden">Доступное скрытие</a></li>
</ul>
</div>
</article>
Expand Down Expand Up @@ -541,6 +542,47 @@ <h3 id="css-font-variant">Варианты шрифта</h3>
</figure>
</div>
</article>

<article class="chapter-part">
<div class="chapter-part-col">
<h3 id="#css-visually-hidden">Доступное скрытие</h3>
<p>
Для того, чтобы контент был скрыт от глаз, но доступен для скринридеров и поисковиков его нужно скрывать используя утилитарный класс <code>visually-hidden</code>.
</p>
</div>
<div class="chapter-part-col gray-bgcolor">
<figure>
<pre><code class="language-css">/* Плохо: скрывать элемент с помощью font-size, display:none */
h1 {
font-size: 0;
}

.title {
display: none;
}</code></pre>
</figure>
<figure>
<pre><code class="language-css">
/* Хорошо: использован класс visually-hidden */
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
border: 0;
padding: 0;
white-space: nowrap;
clip-path: inset(100%);
clip: rect(0 0 0 0);
overflow: hidden;
}</code></pre>
</figure>
<figure>
<pre><code class="language-markup">
&lt;h2 class="visually-hidden"&gt;Заголовок&lt;/h2&gt;</code></pre>
</figure>
</div>
</article>
</section>
</main>

Expand Down