Printed from TeacherJohn.com • http://teacherjohn.com/cabrillo/dm60a/exercises/ex06.php

Exercise 6: Local Styles, Classes, IDs, and Pseudo-classes


Resources for this exercise:


Step 1 - Create your exercise 6 page

1.1) Using a basic text editor, create a Web page for exercise 6.

1.2) This page must display your name and say "Exercise 6".

1.3) This page's <title> must indicate that this is your exercise 6 page, so it should say something like "John Sky's DM60 Exercise 6".

1.4) This page must contain the HTML 5 DocType that will enable you to use an HTML validator, as explained in How to Use the W3C HTML and CSS Validators.

1.5) This page must contain the character encoding meta tag (as explained in Character Encoding for Web Pages). Because this tag tells the browser how to interpret the characters used in the document, it should be the first tag in the <head> section. So right after the <head> tag, place this line of code:

<meta charset="utf-8">

1.6) This page must contain links (either buttons or text links) to the HTML and CSS validators. See How to Put HTML and CSS Validate Buttons on Your Page for information on how I want you to to do this. Make sure you use the code for HTML 5 (not XHTML 1.0 Strict nor HTML 4, for example). (Use the block of code on this page to make the button links or text links, so that clicking on the links automatically lets you know if the page validates or not.)

Make sure you use the correct links (for HTML 5).

1.7) This page must contain a link with a relative path to your home ("index.html") page (this path will not start with "http://", as it must be a relative path, not a URL).

1.8) This page must demonstrate the use of at least three different local styles.

1.9) This page must demonstrate the use of all the different style rules that you define in your external style sheet. (In the next step you will create an external style sheet. Your page must demonstrate the use of the styles of these rules.)

This page must demonstrate the use of styles applied to <div> and <span> tags. For example:

1.10) This page must contan a <link> tag in the <head> section that links this page to your external style sheet. Because your external style sheet will be uploaded into your "css" folder, the relative path from this page to your external style sheet will look something like this: "css/exercise6.css". So your <link> tag will look like this:

<link rel="stylesheet" href="css/exercise6.css" type="text/css">

1.11) Save this page as "exercise6.html".

Step 2 - Create your external cascading style sheet

2.1) Using a basic text editor, create an external style sheet for exercise 6. This style sheet must be a new file, different from any style sheets created for previous exercises.

2.2) In this style sheet define at least three classes (not including any pseudo-classes).

2.3) In this style sheet define a hover pseudo-class.

2.4) In this style sheet define at least one other pseudo-class.

2.5) In this style sheet define at least two IDs.

2.6) In this style sheet define at least three other CSS rules. (This means that the style sheet will contain a total of at least ten CSS rules.)

2.7) The style sheet must be saved as a text (or ASCII) document, just as a Web page would be saved as text. Remember to name your external style sheet with a ".css" file name extension ("exercise6.css" for example).

Step 3 - Upload and validate your page and external style sheet

3.1) Upload your Web page to your "public_html" folder on the server, as you normally would.

3.2) Upload your external cascading style sheet into your "css" folder that is within your public_html folder.

3.3) View your page (the page on the server, not the page on your local disk) in a browser. If you can, view your page in at least two different browsers to make sure it works properly!

3.4) Make sure the HTML on this page validates (using the HTML 5 Doctype) with no errors, according to the W3C's online HTML Validator at http://validator.w3.org/. You can easily do this by clicking on your HTML validator link. For more information, see How to Use the W3C HTML and CSS Validators for step-by-step directions.

3.5) Make sure the CSS on this page validates, with no errors, according to the W3C's online CSS Validator at: http://jigsaw.w3.org/css-validator/. You can easily do this by clicking on your CSS validator button. See the CSS section of How to Use the W3C HTML and CSS Validators for step-by-step directions.

Note that when you use the CSS validator to check a page that has a link to an external style sheet, the CSS validator will follow the link from the page to the style sheet to see if the styles are valid. But if you get the "No style sheet found" warning it probably means that the path in your <link> tag to the external style sheet is incorrect (and your styles will not show up).

3.6) If there are any errors, fix them, re-upload the page or style sheet, and validate them again.

Step 4 - Modify your home page

4.1) Modify your home page to include a link that goes to your exercise 6 page. Make sure your home page has a working link to each of your completed exercises, and that these links are coded as an HTML list.

4.2) As always, your home page must contain links (either buttons or text links) to the HTML and CSS validators. See How to Put HTML and CSS Validate Buttons on Your Page for information on how I want you to to do this. Make sure you use the code for HTML 5 (not XHTML 1.0 Strict nor HTML 4, for example). (Use the block of code on this page to make the button links or text links, so that clicking on the links automatically lets you know if the page validates or not.)

4.3) Make sure the HTML on this page validates (using the HTML 5 Doctype) with no errors, according to the W3C's online HTML Validator at http://validator.w3.org/. You can easily do this by clicking on your HTML validator link. For more information, see How to Use the W3C HTML and CSS Validators for step-by-step directions.

4.4) Make sure the CSS on this page validates, with no errors, according to the W3C's online CSS Validator at: http://jigsaw.w3.org/css-validator/. You can easily do this by clicking on your CSS validator button. See the CSS section of How to Use the W3C HTML and CSS Validators for step-by-step directions.

4.5) View your home page (the page on the server, not the page on your local disk) in a Web browser to make sure your links work.

4.6) If there are any errors, fix them, re-upload the page, and validate it again.

Step 5 - Submit the feedback form

5.1) Submit the feedback form. To receive full credit for this exercise you must submit this feedback form before it expires. This exercise is due on 3/17/14. Allowing for a one-day grace period, the form will expire at the end of the day following the due date, which means the form for this exercise will expire at 12:00 AM on 03/19/14.