Skip to content

Commit 3e36adf

Browse files
committed
Toolbar: Constrain the site icon's size.
The toolbar site icon added in 7.1 is sized only by `width` and `height`. A theme or plugin rule such as `img { width: auto !important; height: auto !important; }` overrides those, and the icon renders at the size of the image file. Add matching `max-width`, `max-height`, `min-width`, and `min-height`, and qualify the selector with `img` for added specificity, so the icon stays 20 pixels square, or 28 pixels on small screens. Follow-up to r62625. Props donniam, kgagne, khokansardar, jorbin, webverts, adrianduffell, iamchitti, joedolson, sabernhardt, adamsilverstein. Fixes #65912. git-svn-id: https://develop.svn.wordpress.org/trunk@64034 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2ca6eae commit 3e36adf

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

‎src/wp-includes/css/admin-bar.css‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,9 +590,14 @@ html:lang(he-il) .rtl #wpadminbar * {
590590
content: none;
591591
}
592592

593-
#wpadminbar #wp-admin-bar-site-name > .ab-item .site-icon {
593+
/* The adminbar icon needs additional styling to prevent 3rd party styles from overriding the size. */
594+
#wpadminbar #wp-admin-bar-site-name > .ab-item img.site-icon {
594595
width: 20px;
595596
height: 20px;
597+
max-width: 20px;
598+
max-height: 20px;
599+
min-width: 20px;
600+
min-height: 20px;
596601
border-radius: 2px;
597602
}
598603

@@ -942,12 +947,16 @@ html:lang(he-il) .rtl #wpadminbar * {
942947
display: block;
943948
}
944949

945-
#wpadminbar #wp-admin-bar-site-name > .ab-item .site-icon {
950+
#wpadminbar #wp-admin-bar-site-name > .ab-item img.site-icon {
946951
position: absolute;
947952
top: 9px;
948953
left: 12px;
949954
width: 28px;
950955
height: 28px;
956+
max-width: 28px;
957+
max-height: 28px;
958+
min-width: 28px;
959+
min-height: 28px;
951960
margin: 0;
952961
border-radius: 4px;
953962
}

0 commit comments

Comments
 (0)