Clamp Fluid Typography Responsive

Create fluid typography that scales between minimum and maximum sizes using the CSS clamp function with viewport units.

CssData Integrity

Code

snippet
h1 {
  font-size: clamp(1.5rem, 4vw + 1rem, 3rem);
  line-height: 1.2;
}

h2 {
  font-size: clamp(1.25rem, 3vw + 0.75rem, 2.25rem);
  line-height: 1.3;
}

p {
  font-size: clamp(1rem, 1.5vw + 0.5rem, 1.125rem);
  line-height: 1.6;
}

.container {
  max-width: clamp(320px, 90vw, 1200px);
  margin: 0 auto;
}