wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_print_auto_sizes_contain_css_fix › WordPress Function
Since6.7.1
Deprecatedn/a
› wp_print_auto_sizes_contain_css_fix ( No parameters )
See: | |
Defined at: |
|
Codex: |
Prints a CSS rule to fix potential visual issues with images using `sizes=auto`.
This rule overrides the similar rule in the default user agent stylesheet, to avoid images that use e.g.width: auto
or width: fit-content
to appear smaller.Source
function wp_print_auto_sizes_contain_css_fix() { /** This filter is documented in wp-includes/media.php */ $add_auto_sizes = apply_filters( 'wp_img_tag_add_auto_sizes', true ); if ( ! $add_auto_sizes ) { return; } ?> <style>img:is([sizes="auto" i], [sizes^="auto," i]) { contain-intrinsic-size: 3000px 1500px }</style> <?php }