Make WordPress Core

Changeset 64035


Ignore:
Timestamp:
10/01/2026 07:33:07 PM (11 days ago)
Author:
whyisjake
Message:

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.

Reviewed by <second-committer>.
Merges r64034 to the 7.1 branch.

Props donniam, kgagne, khokansardar, jorbin, webverts, adrianduffell, iamchitti, joedolson, sabernhardt, adamsilverstein.
Fixes #65912.

Location:
branches/7.1
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/7.1

  • branches/7.1/src/wp-includes/css/admin-bar.css

    r63555 r64035  
    599599}
    600600
    601 #wpadminbar #wp-admin-bar-site-name > .ab-item .site-icon {
     601/* The adminbar icon needs additional styling to prevent 3rd party styles from overriding the size. */
     602#wpadminbar #wp-admin-bar-site-name > .ab-item img.site-icon {
    602603        width: 20px;
    603604        height: 20px;
     605        max-width: 20px;
     606        max-height: 20px;
     607        min-width: 20px;
     608        min-height: 20px;
    604609        border-radius: 2px;
    605610}
    … …  
    947952        }
    948953
    949         #wpadminbar #wp-admin-bar-site-name > .ab-item .site-icon {
     954        #wpadminbar #wp-admin-bar-site-name > .ab-item img.site-icon {
    950955                position: absolute;
    951956                top: 9px;
    … …  
    953958                width: 28px;
    954959                height: 28px;
     960                max-width: 28px;
     961                max-height: 28px;
     962                min-width: 28px;
     963                min-height: 28px;
    955964                margin: 0;
    956965                border-radius: 4px;
Note: See TracChangeset for help on using the changeset viewer.