CSS selector costs

Published: Oct 8, 2025

If recalculate style costs remain high, selector optimization can reduce them. Optimize the selectors with both high elapsed time and high slow-path percentages. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.

How to pass this insight

This insight always passes, but may still show for informational purposes.

It only appears in the DevTools Performance panel when the setting Enable CSS selector stats (slow) is on.

Additional references

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年10月08日 UTC.