1. Fill in the blank to code a div that doesn't scroll.
position: ____;
That's correct. Well done!
The correct code:
fixed
Press Tab or click button to advance to next exercise.
2. Fill in the blank to code a div that does scroll, and is positioned precisely where you want it.
position: ______;
That's correct. Well done!
The correct code:
absolute
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
3. A div can be positioned so many pixels from the top, right, bottom, or ____.
That's correct. Well done!
The correct answer:
left
Press Tab or click button to advance to next exercise.
4. Fill in the blank to position a div 100 pixels from the lower edge.
_____ 100;
That's correct. Well done!
The correct code:
bottom:
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 the first two lines of a div that doesn't scroll.
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.
Code the two lines of a div that places it on the bottom-right corner. Specify the right part first.
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.
Code the two lines that place the div at the top and all the way over on the right. Don't bother indenting.
Press Tab or click button to advance to next exercise.
That's correct. Well done!
8. Code the first two lines of a div that doesn't scroll. Make up the ID.
That's correct. Well done!
Example:
div#ad_banner {
position: fixed;
Press Tab or click button to advance to next exercise.
9. Code the first two lines of a div that does scroll and is placed precisely where you want it. Make up the ID.
That's correct. Well done!
Example:
div#ad_banner {
position: absolute;
Press Tab or click button to advance to next exercise.
10. Code two lines that place a div precisely. Choose top or bottom then left or right. Don't bother indenting.
That's correct. Well done!
The correct code:
top: 0;
right: 0;
Press Tab or click button to advance to next exercise.
11. Code two lines that place a div precisely, specifying a positive number of pixels (not 0). Don't bother indenting.
That's correct. Well done!
Example:
bottom: 100px;
right: 100px;
Press Tab or click button to advance to next exercise.
12. Style a div that doesn't scroll. Choose top or bottom then left or right. Specify the position in a positive number of pixels (not 0). Make up the ID.
That's correct. Well done!
Example:
div#advert {
position: fixed;
bottom: 100px;
right: 100px;
}
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: 25 seconds. Code the two lines that place the div at the top and all the way over on the right.
Press Tab or click button to check answer.
The correct code:
top: 0;
right: 0;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
14. Time goal: 35 seconds. Code the first two lines of a div that doesn't scroll. Make up the ID.
Press Tab or click button to check answer.
Example:
div#ad_banner {
position: fixed;
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. Code the first two lines of a div that does scroll and is placed precisely where you want it. Make up the ID.
Press Tab or click button to check answer.
Example:
div#ad_banner {
position: absolute;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
16. Time goal: 20 seconds. Code two lines that place a div at the top and all the way over on the right. Don't bother indenting.
Press Tab or click button to check answer.
The correct code:
top: 0;
right: 0;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
17. Time goal: 25 seconds. Code two lines that place a div precisely. Choose top or bottom then left or right. Specify the position in a positive number of pixels (not 0). Don't bother indenting.
Press Tab or click button to check answer.
Example:
bottom: 100px;
right: 100px;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
18. Time goal: 65 seconds. Style a div that doesn't scroll. Choose top or bottom then left or right. Specify the position in a positive number of pixels (not 0). Make up the ID.
Press Tab or click button to check answer.
Example:
div#advert {
position: fixed;
bottom: 100;
right: 100;
}
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