Skip to content
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

Document speak-as CSS property. #37706

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion files/en-us/_redirects.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12106,7 +12106,6 @@
/en-US/docs/Web/CSS/sign() /en-US/docs/Web/CSS/sign
/en-US/docs/Web/CSS/sign_function /en-US/docs/Web/CSS/sign
/en-US/docs/Web/CSS/single-transition-timing-function /en-US/docs/Web/CSS/easing-function
/en-US/docs/Web/CSS/speak-as /en-US/docs/Web/CSS/@counter-style/speak-as
/en-US/docs/Web/CSS/static /en-US/docs/Web/CSS/position
/en-US/docs/Web/CSS/suffix /en-US/docs/Web/CSS/@counter-style/suffix
/en-US/docs/Web/CSS/symbols() /en-US/docs/Web/CSS/symbols
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/css/@counter-style/speak-as/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: speak-as
title: speak-as (@counter-style)
slug: Web/CSS/@counter-style/speak-as
page-type: css-at-rule-descriptor
browser-compat: css.at-rules.counter-style.speak-as
Expand Down
83 changes: 83 additions & 0 deletions files/en-us/web/css/speak-as/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
title: speak-as
slug: Web/CSS/speak-as
page-type: css-property
browser-compat: css.properties.speak-as
---

{{CSSRef}}

The **`speak-as`** property is a part of [CSS](/en-US/docs/Web/CSS) Speech, which is used to manipulate how the [HTML](/en-US/docs/Web/HTML) content is spoken by assistive technologies, especially screen readers. More specifically, **`speak-as`** specifies how elements (any HTML element if not paired with [@counter-style](/en-US/docs/Web/CSS/@counter-style/speak-as)) and/or their content are spoken.

## Syntax

```css
speak-as: normal;
speak-as: spell-out;
speak-as: literal-punctuation;
speak-as: digits;
speak-as: no-punctuation;
```

### Values

- `normal`
- : Default value, which uses normal pronunciation rules, but punctuation is replaced by pauses. For example, instead of "Hello, world!" it would be pronounced as "Hello (pause) world (pause)"
- `spell-out`
- : Content is spelled out letter by letter. For example, "role" would be pronounced "r" "o" "l" "e".
- `literal-punctuation`
- : Punctuation marks are spelled out literally. For example, instead of "Hello, world!" it would be pronounced as "Hello comma world exclamation mark.".
- `digits`
- : Numbers are pronounced as individual digits. For example, 31 is pronounced as "three one".
- `no-punctuation`
- : The content is pronounced normally without any punctuation. For example, instead of "Hello, world!" it would be pronounced as "Hello world".

> [!NOTE]
> The support of `speak-as` property is very limited or inconsistently implemented across different assistive technologies (such as screen readers or speech synthesizers). It's often recommended not to fully rely on it solely to deliver your critical information, to ensure it remains user friendly and accessible to a wide audience.

## Example

### HTML

```HTML
<p class="normal">Hello, world!</p>
<p class="spell-out">Hello, world!</p>
<p class="literal-punctuation">Hello, world!</p>
<p class="no-punctuation">Hello, world!</p>
<p class="digits">25</p>
```

### CSS

```CSS
.normal {
speak-as: normal;
}

.spell-out {
speak-as: spell-out;
}

.literal-punctuation {
speak-as: literal-punctuation;
}

.no-punctuation {
speak-as: no-punctuation;
}

.digits {
speak-as: digits;
}
```

## Browser compatibility

{{Compat}}
younisdev marked this conversation as resolved.
Show resolved Hide resolved

## See also

- How to use [speak-as descriptor](/en-US/docs/Web/CSS/@counter-style/speak-as) as descriptor for {{cssxref("@counter-style")}} which is part of the `@counter-style` at-rule.
- More information on {{cssxref("@counter-style")}}.
- [CSS counter styles](/en-US/docs/Web/CSS/CSS_counter_styles)
- [CSS lists and counters](/en-US/docs/Web/CSS/CSS_lists)
Loading