Problem: Fluid Hero Heading and Subheading
Problem description
Given a .hero section containing <h2> and <h3>, write CSS rules to:
Define CSS custom properties
--min-heading(32px) and--max-heading(56px).Define CSS custom properties
--min-subheading(24px) and--max-subheading(32px).Create fluid
font-sizevariables--fluid-headingand--fluid-subheadingusingclamp()withcalc()to interpolate between these minimum and maximum values for viewport widths from360pxto1440px.Apply
--fluid-headingtoh2and--fluid-subheadingtoh3.
Goal
Use CSS custom properties and clamp() with a linear interpolation to maintain consistent typographic scale for both headings and subheadings across viewports.
Constraints
The solution must use an external stylesheet named
styles.css.Do not use JavaScript.
Support all modern browsers.
Viewport widths should be between
360pxand1440px.Headings (
h2) must have a minimum font size of32pxand a maximum font size of56px.Subheadings (
h3) must have a minimum font size of24pxand a maximum font size of32px.
Sample visual output
Here’s what the output would look like:
Good luck trying the problem! If you’re unsure how to proceed, check the Solution.
Problem: Fluid Hero Heading and Subheading
Problem description
Given a .hero section containing <h2> and <h3>, write CSS rules to:
Define CSS custom properties
--min-heading(32px) and--max-heading(56px).Define CSS custom properties
--min-subheading(24px) and--max-subheading(32px).Create fluid
font-sizevariables--fluid-headingand--fluid-subheadingusingclamp()withcalc()to interpolate between these minimum and maximum values for viewport widths from360pxto1440px.Apply
--fluid-headingtoh2and--fluid-subheadingtoh3.
Goal
Use CSS custom properties and clamp() with a linear interpolation to maintain consistent typographic scale for both headings and subheadings across viewports.
Constraints
The solution must use an external stylesheet named
styles.css.Do not use JavaScript.
Support all modern browsers.
Viewport widths should be between
360pxand1440px.Headings (
h2) must have a minimum font size of32pxand a maximum font size of56px.Subheadings (
h3) must have a minimum font size of24pxand a maximum font size of32px.
Sample visual output
Here’s what the output would look like:
Good luck trying the problem! If you’re unsure how to proceed, check the Solution.