Skip to content

Instantly share code, notes, and snippets.

@elfacht
Created January 5, 2022 10:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elfacht/5647a4e4746b1ac17c5968891ef80d2e to your computer and use it in GitHub Desktop.
Save elfacht/5647a4e4746b1ac17c5968891ef80d2e to your computer and use it in GitHub Desktop.
min(), max(), clamp()
// min() / max()
.element{
// old
width: 50vw;
max-width: 500px;
// new
width: min(50vw, 500px);
}
// clamp()
.element {
font-size: clamp(1rem, 2.5vw, 2rem);
width: clamp(250px, 50vw, 750px);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment