Set #box to 50% opacity using a decimal.
Acceptance criteria
- 1.Set #box to 50% opacity using a decimal.
CSS Tutorial · CSS Effects
These 10 tasks go with the CSS Opacity 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: “The CSS Opacity property is used to control the transparency level of an element.” Read the chapter.
1.Half-fade an elementexercise · easy · 10 min
Set #box to 50% opacity using a decimal.
Passes when: Set #box to 50% opacity using a decimal.
2.Use a percentageexercise · easy · 10 min · practice plan
Set #box to 35% opacity using a percentage.
Passes when: Set #box to 35% opacity using a percentage.
3.Fade it out entirelyexercise · easy · 10 min · practice plan
Make #box fully transparent but still take up space.
Passes when: Make #box fully transparent but still take up space.
4.Fade the whole groupexercise · easy · 10 min · practice plan
Set #wrap to 0.75 so everything inside fades together.
Passes when: Set #wrap to 0.75 so everything inside fades together.
5.Fade the background onlyexercise · medium · 10 min · practice plan
A half-transparent background with fully opaque text.
Passes when: A half-transparent background with fully opaque text.
6.Fix the value above onebug fix · easy · 8 min
An opacity of 2 clamps to fully opaque.
Passes when: An opacity of 2 clamps to fully opaque.
7.Fix the missing percent signbug fix · easy · 8 min · practice plan
Without a % this reads as 35, which clamps to 1.
Passes when: Without a % this reads as 35, which clamps to 1.
8.Fix visibility used to fadebug fix · easy · 8 min · practice plan
Fading to nothing uses opacity.
Passes when: Fading to nothing uses opacity.
9.Fix the opacity on the wrong elementbug fix · easy · 8 min · practice plan
The whole group should fade together.
Passes when: The whole group should fade together.
10.Fix the faded textbug fix · easy · 8 min · practice plan
Only the background should be translucent, not the contents.
Passes when: Only the background should be translucent, not the contents.
Between them these tasks cover opacity, Percentage opacity and Opacity vs alpha.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.