The new CSS property that boosts your rendering performance (2020)
The `content-visibility` CSS property enhances web performance by skipping off-screen content, improving load times, and working with CSS Containment. It preserves rendering state while optimizing rendering decisions.
Read original articleThe new CSS property `content-visibility`, introduced in Chromium 85, significantly enhances web page rendering performance by allowing browsers to skip rendering off-screen content until it is needed. This property enables faster initial load times and improved interaction speeds with visible content. When applied, `content-visibility: auto` can lead to a remarkable 7x performance boost in rendering times, as demonstrated in a travel blog example where rendering times dropped from 232ms to 30ms. The property works in conjunction with CSS Containment, which isolates DOM subtrees, allowing browsers to optimize rendering decisions. While `content-visibility` is currently supported in Chromium, it is still being prototyped for Firefox. Developers can also use `contain-intrinsic-size` to specify the size of elements affected by size containment, ensuring that layout remains stable. Additionally, `content-visibility: hidden` allows developers to keep content unrendered while preserving its rendering state, making it useful for single-page applications and virtual scrolling. However, developers must be cautious not to call any DOM APIs that could trigger rendering for skipped subtrees. Overall, `content-visibility` offers a powerful tool for optimizing web performance while maintaining accessibility.
- `content-visibility` improves rendering performance by skipping off-screen content.
- The property can lead to significant reductions in initial load times.
- It works alongside CSS Containment for better optimization.
- Developers should avoid certain DOM API calls to maintain performance benefits.
- `content-visibility: hidden` preserves rendering state for unrendered content.
Related
SVG Triangle of Compromise
The article explores SVG (Scalable Vector Graphics) on the web, highlighting its stylability, cacheability, and dimensionality, while discussing advantages and challenges in web design and performance considerations.
Blocking=render: Why would you do that?
WebKit's blocking=render attribute delays rendering until scripts are fully loaded, improving user experience by preventing invisible interactions. It allows progressive rendering but may increase render-blocked periods based on browser heuristics.
Can you convert a video to pure CSS?
The article explores converting video content into CSS animations, highlighting browser compatibility issues, particularly with Safari, and suggesting JavaScript alternatives for cross-browser functionality while detailing performance differences.
How Chrome Accessibility Works
The document details Chrome's accessibility features, emphasizing platform-specific APIs, the automatic provision of accessibility in standard UI toolkits, and challenges with custom controls and multi-process browser adaptations.
CSS @property and the New Style
The CSS @property at-rule now supports custom properties, enhancing animated gradients and transitions. It offers techniques for hover effects and shiny borders, with resources for further exploration provided.
The new CSS property that boosts your rendering performance (web.dev)
4 points by cmpit 1 hour ago
Needs (2020)> Last updated 2020-08-05 UTC.
Containment spec, which `content-visibility` is built on top of, reaches around 95%, (98% mobile) [1].
Related
SVG Triangle of Compromise
The article explores SVG (Scalable Vector Graphics) on the web, highlighting its stylability, cacheability, and dimensionality, while discussing advantages and challenges in web design and performance considerations.
Blocking=render: Why would you do that?
WebKit's blocking=render attribute delays rendering until scripts are fully loaded, improving user experience by preventing invisible interactions. It allows progressive rendering but may increase render-blocked periods based on browser heuristics.
Can you convert a video to pure CSS?
The article explores converting video content into CSS animations, highlighting browser compatibility issues, particularly with Safari, and suggesting JavaScript alternatives for cross-browser functionality while detailing performance differences.
How Chrome Accessibility Works
The document details Chrome's accessibility features, emphasizing platform-specific APIs, the automatic provision of accessibility in standard UI toolkits, and challenges with custom controls and multi-process browser adaptations.
CSS @property and the New Style
The CSS @property at-rule now supports custom properties, enhancing animated gradients and transitions. It offers techniques for hover effects and shiny borders, with resources for further exploration provided.