wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_print_auto_sizes_contain_css_fix › WordPress Function

Seit6.7.1
Veraltetn/v
wp_print_auto_sizes_contain_css_fix ( Keine Parameter )
Siehe:
Definiert in:
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.


Quellcode

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
}