Float #box to the left.
Acceptance criteria
- 1.Float #box to the left.
CSS Tutorial · CSS Layout
These 10 tasks go with the CSS Float 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 Float property is used to position an element to the left or right side of its container, allowing surrounding content to wrap around it.” Read the chapter.
1.Float leftexercise · easy · 10 min
Float #box to the left.
Passes when: Float #box to the left.
2.Float rightexercise · easy · 10 min · practice plan
Float #box to the right.
Passes when: Float #box to the right.
3.Clear a floatexercise · easy · 10 min · practice plan
Make #text clear both floats.
Passes when: Make #text clear both floats.
4.Clear one sideexercise · easy · 10 min · practice plan
Make #text clear left floats only.
Passes when: Make #text clear left floats only.
5.Contain floats with flow-rootexercise · medium · 10 min · practice plan
Use display: flow-root on the wrapper.
Passes when: Use display: flow-root on the wrapper.
6.Fix the misspelled propertybug fix · easy · 8 min
The property is float.
Passes when: The property is float.
7.Fix the wrong directionbug fix · easy · 8 min · practice plan
The box should float right.
Passes when: The box should float right.
8.Fix the invalid clear valuebug fix · easy · 8 min · practice plan
"all" is not a clear value; use both.
Passes when: "all" is not a clear value; use both.
9.Fix clear applied to the float itselfbug fix · easy · 8 min · practice plan
The clearing belongs on the following element.
Passes when: The clearing belongs on the following element.
10.Fix the overflow hackbug fix · easy · 8 min · practice plan
Use display: flow-root instead of overflow to contain floats.
Passes when: Use display: flow-root instead of overflow to contain floats.
Between them these tasks cover float left and right, clear and Modern alternatives.
Looking for a different chapter? See every practice set, or switch to the interview theory questions.