Last active
September 22, 2023 18:11
Star
You must be signed in to star a gist
min() max() clamp()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.sidebar { | |
/* Select smaller of the 2 calculated values | |
Narrower screens: 20vw, Wider screens: 300px */ | |
width: min(20vw, 300px); | |
} | |
.make-the-logo-bigger { | |
/* Select larger of the 2 calculated values | |
Basically clamps the font size to 60px or larger (10vw) */ | |
font-size: max(60px, 10vw); | |
} | |
.ok-lets-not-get-crazy { | |
/* Given a min and max value, select the best | |
fit based on the middle argument. (<min>, <value>, <max>) | |
The font size will always be between 1rem and 2rem, | |
using 10vw until it hits the min or max */ | |
font-size: clamp(1rem, 10vw, 2rem) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment