Define how and where to use REM units

Created on 9 December 2020, over 3 years ago
Updated 20 September 2023, 12 months ago

Problem/Motivation

In #3117698: Allow PostCSS Plugin “Px to Rem” in core for Olivero theme there was a good discussion about how and where to use REM units. See #3117698-24: Allow PostCSS Plugin “Px to Rem” in core for Olivero theme .

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

Postponed: needs info

Version

11.0 🔥

Component
CSS 

Last updated 1 day ago

Created by

🇬🇧United Kingdom alexpott 🇪🇺🌍

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    There was nothing to review code wise.
    Could this one be closed out?

  • 🇬🇧United Kingdom 2dareis2do

    We should not use the on certain pseudo selectors e.g.

    .toolbar .toolbar-icon::before {
    

    see https://www.drupal.org/project/drupal/issues/3332943 Claro - fix issues with icon sizes Needs work

    I would also suggest avoiding using them on the root/html as the base font sizing can be adjusted there with media queries

    e.g.

    html {
        font-size: 14px;
        -webkit-text-size-adjust: none;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
    }
    
    @media only screen and (min-width: 768px) {
        html {
            font-size: 16px;
        }
    }
    
    @media only screen and (min-width: 1200px) {
        html {
            font-size: 18px;
        }
    }

    According to the W3C spec the the key thing to note about rem units is::

    Equal to the computed value of font-size on the root element. When specified on the font-size property of the root element, the rem units refer to the property’s initial value.

    https://www.sitepoint.com/understanding-and-using-rem-units-in-css/

Production build 0.71.5 2024