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.
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.
Comments
Comment #2
gauravvvv commentedUse rem units for sizing that doesn't need em units, and that should scale depending on browser font size settings. Use rem units unless you're sure you need em units, including on font sizes. Use rem units on media queries. Don't use em or rem in multi-column layout widths - use % instead.
Found an article for this: https://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use...
Comment #3
Madhu kumar commentedThanks @Gauravmahlawat
Article help me to understand the basics about to use REM units
Comment #5
radheymkumar commented@Gauravmahlawat
Thanks
Comment #6
Saurabh Srivastava commented.
Comment #7
Saurabh Srivastava commentedem units for the font-size property will be relative to the font size of the parent element.
em units on other properties than font size will be relative to the font size of the current element.
rem units sizes will always be relative to the font size of the root HTML element.
I searched some articles. Here I am sharing them with you Please have a look at them.
1. https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units
2. https://www.digitalocean.com/community/tutorials/css-rem-vs-em-units
3. https://webdesign.tutsplus.com/tutorials/comprehensive-guide-when-to-use-em-vs-rem--cms-23984
Comment #11
smustgrave commentedThere was nothing to review code wise.
Could this one be closed out?
Comment #13
2dareis2do commentedWe should not use the on certain pseudo selectors e.g.
see https://www.drupal.org/project/drupal/issues/3332943
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.
According to the W3C spec the the key thing to note about rem units is::
https://www.sitepoint.com/understanding-and-using-rem-units-in-css/
Comment #14
smustgrave commentedShould this be moved to documentation I wonder.
Comment #15
smustgrave commented@alexpott what are your thoughts to #14