Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
This utility makes content accessible to assistive devices without displaying it on the screen.
“There are real world situations where visually hiding content may be
appropriate, while to content should remain available to assistive
technologies, such as screen readers. For instance, hiding a search field’s
label as a common magnifying glass icon is used in its stead.”
Since visually hidden content can receive focus when tabbing, the element will become visible when something inside receives focus. This behaviour is intentional, as otherwise sighted keyboard users wouldn’t be able to determine where the focus indicator is.
<div style="min-block-size: 1.875rem">
<a href="#" class="pc-visually-hidden">Skip to main content</a>
</div>
In this demo, the link will open in a new window. Screen readers will announce it as “opens in a new window” even though the text content isn’t visible to sighted users.
<a href="https://example.com" target="_blank" rel="noreferrer noopener">
Link to example.com
<pc-icon
library="default"
icon-style="solid"
name="arrow-up-right-from-square"
style="font-size: 0.75rem; vertical-align: 0.25rem"
aria-hidden="true"
></pc-icon>
<span class="pc-visually-hidden">opens in a new window</span>
</a>
Adding a label may seem redundant at times, but they’re very helpful for unsighted users. Rather than omit them, you can provide context to unsighted users with visually hidden content that will be announced by assistive devices such as screen readers.
<pc-card style="inline-size: 100%; max-inline-size: 360px">
<header class="pc-visually-hidden">
Personal info
</header>
<pc-input label="Name" style="margin-block-end: var(--pc-spacing-m)"></pc-input>
<pc-input label="E‐mail" type="email"></pc-input>
</pc-card>
There are cases where you want to always visually hide certain content, even when it’s focused. For example when hiding a native checkbox to render a custom one:
If you imported placer.css, you can skip this section. But if you cherry picked from all the CSS files, you can use these snippets to import this utility.
In HTMLIn CSS
To import this utility from the CDN with a link tag, copy this snippet and paste it in your HTML:
Ui! Du bist in die gefährlichen Lande von Placer Toolkit geraten. Version 0 ist veraltet und entspricht nicht den EU‐Datenschutzstandards, einschließlich DSGVO.
Willst du die neuesten Kräfte, Sicherheit und Compliance? Bleib bei der aktuellen Version von Placer Toolkit!