Give #box a z-index of 10 with relative positioning.
Acceptance criteria
- 1.Give #box a z-index of 10 with relative positioning.
CSS Tutorial · CSS Layout
These 10 tasks go with the CSS Z-index 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 Z-index property controls the stacking order of positioned elements on a webpage.” Read the chapter.
1.Raise an elementexercise · easy · 10 min
Give #box a z-index of 10 with relative positioning.
Passes when: Give #box a z-index of 10 with relative positioning.
2.Send an element backexercise · easy · 10 min · practice plan
Give #box a z-index of -1.
Passes when: Give #box a z-index of -1.
3.Stack two elementsexercise · easy · 10 min · practice plan
Put #text above #box.
Passes when: Put #text above #box.
4.Create a stacking contextexercise · easy · 10 min · practice plan
Use opacity to create a context without positioning.
Passes when: Use opacity to create a context without positioning.
5.Layer an absolute elementexercise · medium · 10 min · practice plan
Absolutely position #box and raise it.
Passes when: Absolutely position #box and raise it.
6.Fix z-index without positionbug fix · easy · 8 min
z-index is ignored on a static element.
Passes when: z-index is ignored on a static element.
7.Fix the misspelled propertybug fix · easy · 8 min · practice plan
The property is z-index.
Passes when: The property is z-index.
8.Fix the value with a unitbug fix · easy · 8 min · practice plan
z-index takes a plain integer.
Passes when: z-index takes a plain integer.
9.Fix the reversed stackingbug fix · easy · 8 min · practice plan
#text should sit above #box.
Passes when: #text should sit above #box.
10.Fix the missing negative signbug fix · easy · 8 min · practice plan
Sending an element behind needs a negative index.
Passes when: Sending an element behind needs a negative index.
Between them these tasks cover z-index, Stacking contexts and Position requirement.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.