1. There are two ways to override the browser's default layout and position an element where you want it in the window. They are absolute and _____ positioning.
That's correct. Well done!
The correct answer:
fixed
Press Tab or click button to advance to next exercise.
2. When you want to specify the exact position of an element in the window and allow it to scroll, you use ______ positioning.
That's correct. Well done!
The correct answer:
absolute
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
3. When you want to nudge an element away from its normal position, you use _____ positioning.
That's correct. Well done!
The correct answer:
relative
Press Tab or click button to advance to next exercise.
4. The browser's default positioning is ______ positioning.
That's correct. Well done!
The correct answer:
static
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 move the element below its normal position.
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 line that specifies the type of positioning that nudges an element away from its normal position.
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 line that specifies the browser's default positioning.
Press Tab or click button to advance to next exercise.
That's correct. Well done!
8. Position a class of div so it's nudged down 10 units, using the preferred unit of measurement. Make up the class name.
That's correct. Well done!
Example:
div.spaced {
position: relative;
top: 10px;
}
Press Tab or click button to advance to next exercise.
9. Position a class of image so it's nudged left 20 units, using the preferred unit of measurement. Make up the class name.
That's correct. Well done!
Example:
img.shifted {
position: relative;
right: 20px;
}
Press Tab or click button to advance to next exercise.
10. Style all paragraphs with default positioning.
That's correct. Well done!
Example:
p {
position: static;
}
Press Tab or click button to advance to next exercise.
11. Nudge a div up and to the left. Make up the id and the numbers.
That's correct. Well done!
Example:
div#nudged {
position: relative;
bottom: 20px;
right: 30px;
}
Press Tab or click button to advance to next exercise.
12. Position a div on the bottom right of the window so it doesn't scroll. Make up the id.
That's correct. Well done!
Example:
div#corner {
position: fixed;
bottom: 0;
right: 0;
}
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: 20 seconds. Code the line that specifies the browser's default positioning.
Press Tab or click button to check answer.
The correct code:
position: static;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
14. Time goal: 50 seconds. Position a class of div so it's nudged down 10 units, using the preferred unit of measurement. Make up the class name.
Press Tab or click button to check answer.
Example:
div.spaced {
position: relative;
top: 10px;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
15. Time goal: 50 seconds. Position a class of image so it's nudged left 20 units, using the preferred unit of measurement. Make up the class name.
Press Tab or click button to check answer.
Example:
img.shifted {
position: relative;
right: 20px;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
16. Time goal: 25 seconds. Style all paragraphs with default positioning.
Press Tab or click button to check answer.
Example:
p {
position: static;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
17. Time goal: 65 seconds. Nudge a div up and to the left. Make up the id and the numbers.
Press Tab or click button to check answer.
Example:
div#nudged {
position: relative;
bottom: 20px;
right: 30px;
}
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
18. Time goal: 60 seconds. Position a div on the bottom right of the window so it doesn't scroll. Make up the id.
Press Tab or click button to check answer.
Example:
div#corner {
position: fixed;
bottom: 0;
right: 0;
}
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