Chapter 6: Cascading Style Sheets (CSS)

Notes

6.3 Write a CSS rule that makes all text 1.5 times larger than the base font of the system and colors the text red.
Answer

6.4 Write a CSS rule that removes the underline from all links inside list items (li) and shifts them left by 3 ems.
Answer

6.5 Write a CSS rule that places a background image halfway down the page, tiling it horizontally. The image should remain in place when the user scrolls up or down.
Answer

6.6 Write a CSS rule that gives all h1 and h2 elements a padding of 0.5 ems, a grooved border style and a margin of 0.5 ems.
Answer

6.7 Write a CSS rule that changes the color of all elements containing attribute class = "greenMove" to green and shifts them down 25 pixels and right 15 pixels.
Answer

6.8 Write an XHTML document that shows the results of a color survey. The document should contain a form with radio buttons that allows users to vote for their favorite color. One of the colors should be selected as a default. The document should also contain a table showing various colors and the corresponding percentage of votes for each color. (Each row should be displayed in the color to which it is referring.) Use attributes to format width, border and cell spacing for the table.
Answer

6.9 Add an embedded style sheet to the XHTML document of Fig. 4.5. This style sheet should contain a rule that displays h1 elements in blue. In addition, create a rule that displays all links in blue without underlining them. When the mouse hovers over a link, change the link's background color to yellow.
Answer

6.10 Modify the style sheet of Fig. 6.4 by changing a:hover to a:hver and margin-left to margin left. Validate the style sheet using the CSS Validator. What happens?
Answer