From de4cb54703a1d2653776ecbf8937aedfdb71ecd6 Mon Sep 17 00:00:00 2001 From: Benjamin Intal Date: Tue, 8 Oct 2024 17:22:05 +0800 Subject: [PATCH] fix (optimize css): mobile styles can override tablet styles (#3346) Happens if the very first style encountered in the editor is a mobile style. fixes #3345 Co-authored-by: bfintal@gmail.com <> --- src/css-optimize.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/css-optimize.php b/src/css-optimize.php index e7d04086b..82e1620e7 100644 --- a/src/css-optimize.php +++ b/src/css-optimize.php @@ -396,6 +396,7 @@ public static function generate_css( $styles ) { foreach ( $style_matches[1] as $i => $media_query ) { $media_query = ! empty( $media_query ) ? substr( $media_query, 0, -1 ) : $media_query; + $media_query = str_replace( 'width: ', 'width:', $media_query ); // Ensure that the media query is consistent. $selector = $style_matches[2][ $i ]; $style_rule = $style_matches[3][ $i ];