[wp-trac] [WordPress Trac] #54032: Improve admin-bar style tag with CSS variables

WordPress Trac noreply at wordpress.org
Tue Aug 1 04:37:36 UTC 2023


#54032: Improve admin-bar style tag with CSS variables
-------------------------+-------------------------
 Reporter:  TBschen      |       Owner:  (none)
     Type:  enhancement  |      Status:  closed
 Priority:  low          |   Milestone:
Component:  Toolbar      |     Version:
 Severity:  normal       |  Resolution:  maybelater
 Keywords:  has-patch    |     Focuses:  css
-------------------------+-------------------------

Comment (by letraceursnork):

 @sabernhardt well, about fallback:
 1. We can add smth like that:


 {{{
 <style type="text/css" media="print">#wpadminbar { display:none; }</style>
 <style type="text/css" media="screen">
         :root { --wpadminbar-height: 32px; }
         html { margin-top: 32px; margin-top: var(--wpadminbar-height, 0px)
 !important; }
         * html body { margin-top: 32px; margin-top: var(--wpadminbar-
 height, 0px) !important; }
         @media screen and ( max-width: 782px ) {
                 :root { --wpadminbar-height: 46px; }
         html { margin-top: 46px; margin-top: var(--wpadminbar-height, 0px)
 !important; }
         * html body { margin-top: 46px; margin-top: var(--wpadminbar-
 height, 0px) !important; }
         }
 </style>
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54032#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list