Twenty Seventeen: Fix CSS specificity problem with CSS feature query for `object-fit`

Previously, the theme's CSS feature query for `object-fit` overrode styles it shouldn't have on interior pages.

This moves the feature query farther down in the stylesheet so it takes precedence in the cascade in supported browsers, and applies the appropriate selector for the interior pages. In browsers that don't support feature queries or `object-fit`, the fallback styles are still applied. The problem was that the rules had the same specificity, so this way, the cascade takes over properly. The transforms and position changes for fallbacks are still needed in browsers that don't support `object-fit` and feature queries.

Merge of [39495] to the 4.7 branch.

Props peterwilsoncc, davidakennedy.
See #39073.

git-svn-id: https://develop.svn.wordpress.org/branches/4.7@39497 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90) 2016-12-05 09:29:41 +00:00
parent ac7222bfe9
commit c9df76e2ac
1 changed files with 19 additions and 18 deletions

View File

@ -1690,24 +1690,6 @@ body:not(.title-tagline-hidden) .site-branding-text {
transform: translateX(-50%) translateY(-50%);
}
/* For browsers that support 'object-fit' */
@supports ( object-fit: cover ) {
.has-header-image .custom-header-media img,
.has-header-video .custom-header-media video,
.has-header-video .custom-header-media iframe {
height: 100%;
left: 0;
-o-object-fit: cover;
object-fit: cover;
top: 0;
-ms-transform: none;
-moz-transform: none;
-webkit-transform: none;
transform: none;
width: 100%;
}
}
.wp-custom-header .wp-custom-header-video-button { /* Specificity prevents .color-dark button overrides */
background-color: rgba(34, 34, 34, 0.5);
border: 1px solid rgba(255, 255, 255, 0.6);
@ -1744,6 +1726,25 @@ body:not(.title-tagline-hidden) .site-branding-text {
transform: translateX(-50%) translateY(0);
}
/* For browsers that support 'object-fit' */
@supports ( object-fit: cover ) {
.has-header-image .custom-header-media img,
.has-header-video .custom-header-media video,
.has-header-video .custom-header-media iframe,
.has-header-image:not(.twentyseventeen-front-page):not(.home) .custom-header-media img {
height: 100%;
left: 0;
-o-object-fit: cover;
object-fit: cover;
top: 0;
-ms-transform: none;
-moz-transform: none;
-webkit-transform: none;
transform: none;
width: 100%;
}
}
/* Hides div in Customizer preview when header images or videos change. */
body:not(.has-header-image):not(.has-header-video) .custom-header-media {