CSS Formating

We have seen how Cascading Style Sheets (CSS) can be used to format HTML. In this lab you will apply CSS formatting using a variety of selectors to a cleanly structured HTML website in order to make some common formatting changes.

Lab Objectives

By the end of this lab, students will be able to...

Directions

  1. Download a basic HTML template page and content files to create the beginnings of a web site for PRZ Law - a fictitious Seattle law firm.
    1. Download the zip file prz_formatting.zip
    2. Extract the zip file into the appropriate directory on you computer: either labs or week3
    3. The newly created prz_formatting directory should contain an images and a styles directory and the following files: template.html, attorneys.txt, contactus.txt, faqs.txt, index.txt, legallinks.txt, office.txt, practice.txt, images -> przlogo.gif, and styles -> format.css
  2. Open the template.html file in your editor. You will use this file as a template to create seven HTML pages for the site using the content found in the .txt files. Before you start creating files, review the four major sections of the HTML structure found in the template.html file: header, navigation, content, and footer. Notice template.html is already linked to an external style sheet, format.css located in the styles directory
  3. In a separate window, Open index.txt; select and copy the entire content of the .txt file
  4. Place your cursor between the opening and closing <section id="content"> </section> tags in the body of template.html and Paste the text from index.txt
  5. Insert the cursor in the <title> tag just after the colon. Type the text " Home" just before the closing </title>
  6. Save the new file as index.htmlin the prz_formatting directory
  7. Open the template.html file again in your HTML editor and repeat steps 3—6 to create six additional HTML files using the following content map:
    1. Paste in the contents of attorneys.txt, type " Attorneys", and Save As attorneys.html
    2. Paste in the contents of practice.txt, type " Practice", and Save As practice.html
    3. Paste in the contents of offices.txt, type " Offices", and Save As offices.html
    4. Paste in the contents of faqs.txt, type " FAQs", and Save As faqs.html
    5. Paste in the contents of legallinks.txt, type " Legal Links", and Save As legallinks.html
    6. Paste in the contents of contactus.txt, type " Contact Us", and Save As contactus.html
  8. View all of your new HTML files in the browser and test the links from page to page. If any links are broken re-check that the file names are correct and that you placed all files in the prz_formatting directory.
  9. When all of the HTML files are complete and their links are working, Delete all of the .txt files from the prz_formatting directory
  10. Now we are ready to style all the pages using the PRZ Website Style Guide and your CSS coding skills. Determine which selector and which declaration will most effectively achieve the desired result listed in the style guide. Write most of your CSS rules in the external style sheet format.css. Only minor changes will need to be made to the HTML pages (adding a couple of class attributes and an in-line style to one element.)
  11. Check your completed PRZ website against the resulting pages illustrated in the following images (drawn by Firefox):
PRZ home PRZ Legal Links PRZ FAQs PRZ offices