DEV Community

Discussion on: I need to reduce or alter the font size of parent class based on the font size of span tag inside child class

Collapse
 
brampayrequest profile image
Bram Hammer

You could use css variables.
So for example

:root { --fs: 8.5rem; }
.heading {
    font-size: calc( --fs * 3 );
}
.heading p span {
    font-size: --fs;
}
Enter fullscreen mode Exit fullscreen mode

And change the --fs value for certain screen sizes?