1. To position divs side-by-side, you must assign them widths that add up to no more than ____ of the width of the box that contains them.
That's correct. Well done!
The correct answer:
100%
Press Tab or click button to advance to next exercise.
2. If you want a gutter separating divs, their widths must total less than ____ of the width of the box that contains them.
That's correct. Well done!
The correct answer:
100%
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
3. If you want to position divs side-by-side, you must override their default block display, by using the keyword _____.
That's correct. Well done!
The correct code:
float
Press Tab or click button to advance to next exercise.
4. Fill in the blank for the second of three side-by-side divs.
float: ____;
That's correct. Well done!
The correct code:
left
Press Tab or click button to advance to next exercise.
5. Drag-and-drop: Holding down the left mouse button, drag the pieces of code onto the screen to code a main div that's going to have a sidebar on its right.
6. Click in the box and type the next character. I'll autocomplete. Don't type spaces or carriage returns. When the exercise is complete, I'll turn the exercise number green.
Style the second of three side-by-side divs. Its ID is "d2" Its width is 31%.
That's correct. Well done!
Press Tab or click button to advance to next exercise.
7. Fail-safe coding. If you type the wrong character, I'll cancel the keystroke. Type spaces. When the exercise is complete, I'll turn the exercise number green.
Style the last of three side-by-side divs. Its ID is d3. Its width is 26%
Press Tab or click button to advance to next exercise.
That's correct. Well done!
8. Code the line that prevents the first div from displaying as a block.
That's correct. Well done!
The correct code:
float: left;
Press Tab or click button to advance to next exercise.
9. Three side-by-side divs are the same width. The two gutters are 2% of the outer box. Code the styling for the middle div, whose ID is "mid".
That's correct. Well done!
The correct code:
div#mid {
width: 32%;
float: left;
}
Press Tab or click button to advance to next exercise.
10. Code a side-by-side div. Make up the ID, width, and float position.
That's correct. Well done!
Example:
div#middle {
width: 50%;
float: left;
}
Press Tab or click button to advance to next exercise.
11. Code a div that prevents unintended wraps. Make up the ID.
That's correct. Well done!
Example:
div#endFloat {
clear: both;
}
Press Tab or click button to advance to next exercise.
12. Code two side-by-side divs. The first one is 30% wide. The second one is 65% wide. Make up the IDs.
That's correct. Well done!
Example:
div#l {
width: 30%;
float: left;
}
div#r {
width: 65%;
float: right;
}
Press Tab or click button to advance to next exercise.
The next several exercises are timed. If you type slowly or dislike time pressure, feel free to increase the allotted time.
13. Time goal: 40 seconds. Style the last of three side-by-side divs. Its ID is d3. Its width is 26%
Press Tab or click button to check answer.
The correct code:
div#d3 {
width: 26%;
float: right;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
14. Time goal: 15 seconds. Code the line that prevents the first div from displaying as a block.
Press Tab or click button to check answer.
The correct code:
float: left;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
15. Time goal: 40 seconds. Three side-by-side divs are the same width. The two gutters are 2% of the outer box. Code the styling for the middle div, whose ID is "mid".
Press Tab or click button to check answer.
The correct code:
div#mid {
width: 32%;
float: left;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
16. Time goal: 45 seconds. Code a side-by-side div. Make up the ID, width, and float position.
Press Tab or click button to check answer.
Example:
div#middle {
width: 50%;
float: left;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
17. Time goal: 35 seconds. Code a div that prevents unintended wraps. Make up the ID.
Press Tab or click button to check answer.
Example:
div#endFloat {
clear: both;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
18. Time goal: 80 seconds. Code two side-by-side divs. The first one is 30% wide. The second one is 65% wide. Make up the IDs.
Press Tab or click button to check answer.
Example:
div#l {
width: 30%;
float: left;
}
div#r {
width: 65%;
float: right;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
19. Access this live coding exercise at JS Fiddle. When you've completed the exercise, close the JS Fiddle window, and you'll be returned to this page. (If JS Fiddle displays a warning message saying that your changes will be reset, click Leave this Page.)
Click button to advance.
20. Access this live coding exercise at JS Fiddle. When you've completed the exercise, close the JS Fiddle window, and you'll be returned to this page. (If JS Fiddle displays a warning message saying that your changes will be reset, click Leave this Page.)
Click button to advance.
Post a review on Amazon for the paperback or the Kindle edition.
Email me to give me a compliment, complaint, or correction. I'll respond.
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
1
0