Homework 2


  1. Place each of your answers in a separate .html or .css file and submit your homework using the appropriate script.
  2. Files for this homework assignment can be found in ~bvz/cs460/hw/hw2.

  1. Create a CSS stylesheet named web.css that:

  2. Create a small web document of your own choosing, called web.html, that uses content that incorporates all of the style rules specified in the previous problem. You will need to link in web.css as an external style sheet.

  3. How would I make an individual paragraph element be center-aligned with bold-faced text? Your answer should use an inline style attribute with the p element.

  4. Use a combination of an internal style sheet and an html specification to create the following table. Name your file invoice.html. The style sheet should specify all of the visual formatting for the table. You may not use any visual html formatting elements, such as b, or visual attributes, such as bgcolor in the html specification of the table. Remember that you can replace b elements with strong elements. The colspan attribute is a structural attribute, not a visual formatting attribute, and therefore you will continue to specify the colspan attribute with the table in the html markup file.

    The table should have the following characteristics:

    1. The border should be 1 pixel and the borders should be collapsed.
    2. There should be four columns with the headings description, quantity, price, and total.
    3. The description column should receive 75% of the space, the quantity column should receive 5% of the space, and the price and total fields should each receive 10% of the space.
    4. The actual elements in the four columns should be aligned as follows:
      • description: left-aligned
      • quantity: centered
      • price: right-aligned
      • total: right-aligned
    5. The descriptions of the items should use hanging indents with a 1em indent.
    6. The Sales Tax and Total lines should be formatted as follows:
      • They should span the first three columns
      • The Sales Tax and Total labels should be strong and colored blue, but not the amounts.
      • Both lines should have a gray background created by using equal values of 208 for the red, green, and blue colors.

  5. Check out a slightly modified version of Mike Berry's CS370 homepage. Your job is to redo the web-page using an external style sheet named cs370.css. You should re-create the format as closely as possible using your style sheet. Start by creating your own version of the cs370.html file (you can copy Dr. Berry's cs370.html file from the homework directory). Your version should use html structural tags only. Get rid of all the visual formatting elements, such as the font, br, table, and b tags (and any others that I missed--this list may not be exhaustive). Also get rid of all the visual formatting attributes, such as BACKGROUND, TEXT, ALINK, and bgcolor. Again this list may not be exhaustive. You can copy the gif/jpg files that the cs370.html file uses from the homework directory.