Free CSS Course / Lesson 3 of 20

How to use color, units, and typography in CSS

Typography and color create mood, readability, and visual hierarchy. Use rem, em, and CSS variables to create consistent scales.

What to know about color, units, and typography in CSS

Typography and color create mood, readability, and visual hierarchy. Use rem, em, and CSS variables to create consistent scales. This chapter explains the concept, demonstrates a practical example, and gives you a guided exercise.

How to use color, units, and typography in CSS

Write a rule with a clear selector and declarations, then inspect the cascade in browser developer tools. Prefer reusable classes, responsive units, and visible focus styles.

Example: color, units, and typography in CSS

Use this example as a starting point. Identify the part that controls the result, then adapt it to your own page or project.

body { font-family: "Segoe UI", sans-serif; color: #1f2937; }
h1 { font-size: clamp(2rem, 4vw, 3.5rem); }

Common questions about color, units, and typography

When should I use color, units, and typography?

Use this technique when it expresses the structure, styling, or behavior your page needs. Keep the implementation focused and test it with the surrounding content.

What should I practice next?

Style a responsive card with readable type, consistent spacing, a clear focus state, and a layout that adapts to a narrow screen.

Practice color, units, and typography

Style a responsive card with readable type, consistent spacing, a clear focus state, and a layout that adapts to a narrow screen. Compare your result with the example and check it at both desktop and mobile widths where relevant.

Course progress stays in this browser.