Make WordPress Core

Changeset 64034


Ignore:
Timestamp:
10/01/2026 07:30:57 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.

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/css/admin-bar.css

    r63554 r64034  
    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}
    … …  
    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;
    … …  
    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;
Note: See TracChangeset for help on using the changeset viewer.