1. To center an image between the left and right edges of the page, fill in the blank.
display: _____;
That's correct. Well done!
The correct code:
block
Press Tab or click button to advance to next exercise.
2. To center an image between the left and right edges of the page, fill in the blank.
margin-left: _____;
That's correct. Well done!
The correct code:
auto
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
3. To center an image between the left and right edges of the page, fill in the blank.
margin-left: auto;
___________: auto;
That's correct. Well done!
The correct code:
margin-right
Press Tab or click button to advance to next exercise.
4. When you create the following style, you're overriding the default display mode for images, which is _____.
display: block;
margin-left: auto;
margin-right: auto;
That's correct. Well done!
The correct answer:
inline
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 style all images to center.
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.
To center an image, code the line after the following line.
display: block;
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.
To center an image code the line before the following line.
margin-left: auto;
Press Tab or click button to advance to next exercise.
That's correct. Well done!
8. Code a more concise alternative to the following code.
margin-left: auto;
margin-right: auto;
That's correct. Well done!
The correct code:
margin: 0 auto 0 auto;
Press Tab or click button to advance to next exercise.
9. To center an image, what two lines need to be added to the following code?
img#middle {
display: block;
}
That's correct. Well done!
The correct code:
margin-left: auto;
margin-right: auto;
Press Tab or click button to advance to next exercise.
10. Code the first three lines of a class of image that will center. For the third line, use the first code you learned, not the concise alternative. Make up the class name.
That's correct. Well done!
Example:
img.centr {
display: block;
margin-left: auto;
Press Tab or click button to advance to next exercise.
11. You've coded an image style with the id "mid" that centers an image. Code an HTML image tag that uses this style. Make up the image path including the type. Don't bother with alt or dimension specifications.
That's correct. Well done!
Example:
<img id="mid" src="loris.jpg">
Press Tab or click button to advance to next exercise.
12. Code a class of image that centers and also has an em of padding all around it. Use the concise alternative way to specify margins. Code the padding specification last. Make up the class name.
That's correct. Well done!
Example:
img.featured {
display: block;
margin: 0 auto 0 auto;
padding: 1em;
}
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: 15 seconds. To center an image code the line before the following line.
margin-left: auto;
Press Tab or click button to check answer.
The correct code:
display: block;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
14. Time goal: 25 seconds. Code a more concise alternative to the following code.
margin-left: auto;
margin-right: auto;
Press Tab or click button to check answer.
The correct code:
margin: 0 auto 0 auto;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
15. Time goal: 45 seconds. To center an image, what two lines need to be added to the following code?
img#middle {
display: block;
}
Press Tab or click button to check answer.
The correct code:
margin-left: auto;
margin-right: auto;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
16. Time goal: 50 seconds. Code the first three lines of a class of image that will center. For the third line, use the first code you learned, not the concise alternative. Make up the class name.
Press Tab or click button to check answer.
Example:
img.centr {
display: block;
margin-left: auto;
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
17. Time goal: 30 seconds. You've coded an image style with the id "mid" that centers an image. Code an HTML image tag that uses this style. Make up the image path including the type. Don't bother with alt or dimension specifications.
Press Tab or click button to check answer.
Example:
<img id="mid" src="loris.jpg">
Press Tab or click button to advance to next exercise.
Press Tab or click button to advance to next exercise.
18. Time goal: 75 seconds. Code a class of image that centers and also has an em of padding all around it. Use the concise alternative way to specify margins. Code the padding specification last. Make up the class name.
Press Tab or click button to check answer.
Example:
img.featured {
display: block;
margin: 0 auto 0 auto;
padding: 1em;
}
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