Chad Lawrence

Web Development for Tech Applications (TECH 64095-001)

clawre13@kent.edu

Chapter 05 - Cascading Style Sheets (CSS)

5.1 Assume that the size of the base font on a system is 12 points.

  1. How big is a 36-point font in ems? 3 ems
  2. How big is a 9-point font in ems? .75 ems
  3. How big is a 24-point font in picas? 2 picas
  4. How big is a 12-point font in inches? 1/6 inch
  5. How big is a 1-inch font in picas? 6 picas

5.2 Fill in the blanks in the following statements:

  1. Using the link element allows authors to use external style sheets in their pages.
  2. To apply a CSS rule to more than one element at a time, separate the element names with a(n) comma.
  3. Pixels are a(n) relative-length measurement unit.
  4. The hover pseudoclass is activated when the user moves the mouse cursor over the specified element.
  5. Setting the overflow property to scroll provides a mechanism for containing inner content without compromising specified box dimensions.
  6. span, div is a generic inline element that applies no inherent formatting.
  7. Setting property background-repeat to repeat-y tiles the specified background-image vertically.
  8. To begin a block of styles that applies to only the print media type, you use the declaration @media print, followed by an opening curly brace ({).
  9. The text-indent property allows you to indent the first line of text in an element.
  10. The three components of the box model are the padding, border and margin.

5.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.

5.3 Answer

5.4 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.

5.4 Answer

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

5.5 Answer

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

5.6 Answer

5.7 Make a layout template that contains a header and two columns. Use divs for each layout component, and use float to line up the columns side by side. Give each component a border and/or a background color so you can see where your divs are.

5.7 Answer

5.8 Add an embedded style sheet to the XHTML document in Fig. 5.5. The 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.

pic for question 5-8
pic for question 5-8

5.8 Answer

5.9 Make a navigation button using a div with a link inside it. Give it a border, background, and text color, and make them change when the user hovers the mouse over the button. Use an external style sheet. Make sure your style sheet validates at http://jigsaw.w3.org/css-validator/. Note that some warnings may be unavoidable, but your CSS should have no errors.

5.9 Answer