Skip to content

Courses / CSS3 Mastery: Beginner to Advanced / Fluid Sizing

2,092 people viewed this

Fluid Sizing

8. ch and ex

.article {
  max-width: 70ch;
}

Ch is based on the advance measure of the zero glyph. Ex is based on the x-height of the font. These units can be useful for typography-related sizing, but their actual dimensions depend on the font.

Practice Exercise

Build a landing page with a maximum-width content container, fluid padding, responsive headings, and a hero section that handles mobile browser viewport changes.

Quiz — 10 MCQs

  1. What is rem relative to? (A) Root element font size (B) Viewport width (C) Image dimensions (D) Border thickness. Answer: A. Rem uses the root element's font size.
  2. What is one vw? (A) One percent of viewport width (B) One pixel (C) One percent of root font size (D) One grid track. Answer: A. Vw is viewport-width relative.
  3. What does clamp() accept? (A) Minimum, preferred value and maximum (B) Only a color (C) Three selectors (D) An HTML element and two IDs. Answer: A. Clamp constrains a preferred value within bounds.
  4. What does min() return? (A) The smallest argument value (B) The largest argument value (C) Always zero (D) A random value. Answer: A. Min chooses the smallest computed argument.
  5. What does max() return? (A) The largest argument value (B) The smallest argument value (C) Always 100% (D) A font name. Answer: A. Max chooses the largest computed argument.
  6. What does calc() do? (A) Performs CSS calculations (B) Calculates JavaScript loops (C) Creates images (D) Defines selectors only. Answer: A. Calc evaluates supported CSS math expressions.
  7. What does 100dvh represent? (A) The dynamic viewport height (B) A fixed 100px height (C) Root font size (D) Document width. Answer: A. Dvh tracks the dynamic viewport height.
  8. What is one rem equal to? (A) The root font size, subject to CSS sizing rules (B) Always 16px regardless of configuration (C) Always 1vw (D) One border. Answer: A. Its actual size depends on the root font size.
  9. What is a common use for ch? (A) Constraining text line length (B) Setting a database connection (C) Choosing a CSS selector (D) Making an element fixed. Answer: A. Ch can provide a typography-based measure for line length.
  10. Why use fluid sizing? (A) To adapt dimensions to available space (B) To force every device to the same layout (C) To eliminate accessibility testing (D) To disable media queries. Answer: A. Fluid sizing responds to viewport or contextual dimensions.

Key Takeaways

  • Choose units according to their reference and purpose.
  • Use min(), max(), clamp() and calc() to express responsive constraints.
  • Understand svh, lvh and dvh for modern mobile viewport behavior.

Rate this course

No ratings yet — yours can be the first.

Stars show on this course. Your written note stays private.

Your stars