Make #box 100px + 50px wide.
Acceptance criteria
- 1.Make #box 100px + 50px wide.
CSS Tutorial · CSS Foundations
These 10 tasks go with the CSS Math Functions chapter. 5 of them ask you to build something small from scratch; 5 give you code that is already broken and ask you to work out why. Set aside about 90 minutes for the whole set, though you can do them in any order.
Nothing here is marked by a person. When you press Submit, the editor checks your code against the points listed under each task and tells you straight away what passed and what didn't (you need a free account to submit). If you get stuck, there are hints, and a worked solution once you've had a go. The first 2 tasks are free; the rest are part of the practice plan.
If it's been a while since you read the chapter, here is how it starts: “Build fluid dimensions and dependable constraints by combining calc(), min(), max(), and clamp() with relative CSS units. It shows how calc(), min(), max(), and clamp() express fluid relationships while preserving readable minimum and maximum limits.” .
1.Add with calcexercise · easy · 10 min
Make #box 100px + 50px wide.
Passes when: Make #box 100px + 50px wide.
2.Subtract with calcexercise · easy · 10 min · practice plan
Make #box 200px minus 40px wide.
Passes when: Make #box 200px minus 40px wide.
3.Pick the smaller valueexercise · easy · 10 min · practice plan
Use min() so the width is the smaller of 400px and 250px.
Passes when: Use min() so the width is the smaller of 400px and 250px.
4.Pick the larger valueexercise · easy · 10 min · practice plan
Use max() so the width is the larger of 120px and 300px.
Passes when: Use max() so the width is the larger of 120px and 300px.
5.Clamp a valueexercise · medium · 10 min · practice plan
Clamp the width between 100px and 200px with a 500px preference.
Passes when: Clamp the width between 100px and 200px with a 500px preference.
6.Fix the missing spacesbug fix · easy · 8 min
calc() requires spaces around + and -.
Passes when: calc() requires spaces around + and -.
7.Fix min and max confusedbug fix · easy · 8 min · practice plan
min() picks the smallest — max() was intended here.
Passes when: min() picks the smallest — max() was intended here.
8.Fix the clamp argument orderbug fix · easy · 8 min · practice plan
clamp() takes minimum, preferred, maximum in that order.
Passes when: clamp() takes minimum, preferred, maximum in that order.
9.Fix the missing calcbug fix · easy · 8 min · practice plan
An arithmetic expression needs calc() to be evaluated.
Passes when: An arithmetic expression needs calc() to be evaluated.
10.Fix the mismatched bracketsbug fix · easy · 8 min · practice plan
The closing bracket is missing, so the declaration is dropped.
Passes when: The closing bracket is missing, so the declaration is dropped.
Between them these tasks cover calc(), min() and max() and clamp().
Looking for a different chapter? See every practice set, or switch to the interview theory questions.