Chapter 17

CSS

Examples

Recipe 17.1
Highlighting Text Ranges

Use the CSS Custom Highlight API to highlight text ranges.

Recipe 17.2
Loading Fonts

Use the CSS Font Loading API to control the loading of fonts.

Recipe 17.3
Animating DOM Transitions

Use the View Transitions API to smoothly animate view changes.

Recipe 17.4
Modifying Stylesheets at Runtime

Dynamically add style rules to a stylesheet at runtime.

Recipe 17.5
Conditionally Setting a CSS Class

Toggle class names based on a property.

Recipe 17.6
Matching Media Queries

Evaluate media queries with JavaScript and listen for changes.

Recipe 17.7
Getting an Element's Computed Style

Calculate an element's final styles when stylesheets and other styles are applied.

Web API Cookbook
Joe Attardi