WP 5.9 New Font Sizes Rules – Best Way to Handle
-
Hi, we see that with the update to WordPress 5.9, the rules defining default font sizes (e.g, Small, Normal, Medium, Large, Huge) have changed. Not only has Normal been dropped & Huge replaced, but now all rules are set to override most user/theme specificity by declaring ‘!important’ for the font-size.
Example:
.has-large-font-size {
font-size: var(–wp–preset–font-size–large) !important;
}So we’ve now seen a few of our sites, where we’ve declared font sizes for certain defaults, having their styling broken by this.
– Why would core WordPress decide the final STYLING of elements? Shouldn’t that be up to the theme or user? And what would make the pixel sizes they chose (they were previously em’s) the end-all be-all for all WordPress sites everywhere?!?
– Now, I’m just wondering what the best-practice should be for restoring our sites that currently have styles set for the default font sizes?
– And also, what would be the best-practice for completely new sites we’re starting from scratch?
I don’t really want to get into CSS specificity wars, and trying to ‘out-important’ core rules, as who knows how this might be changed again in the future. Just getting frustrated at having to check & adjust styling when WordPress updates. If it makes any difference, we typically use a child theme of the Astra theme for sites.
Thanks for any insight!
- The topic ‘WP 5.9 New Font Sizes Rules – Best Way to Handle’ is closed to new replies.