CSS 1 : Getting started with CSS
Get Set Up
- Copy the CSS folder from the Outbox.
- Paste it into your root folder.
- Rename it "lastname CSS ", where lastname is your actual last name.
In the CSS folder, you will find
- A fresh copy of the "Head First Lounge" Web site (lounge folder)
- A file called "style.css"
- The CSS lesson in PDF format
Exercise 1 [p.291-293]
- Read pages 285-293 of the Lesson.
- Open "lounge.html" in Notepad.
- Add the <style> element inside the <head> element.
- Add the CSS inside the <style> element which makes all the <p> elements maroon in color.
- Save and test "lounge.html" in the browser.
Exercise 2 [p.294-296]
- Read pages 294-296 of the Lesson.
- Open "lounge.html" in Notepad.
- Add the CSS for the <h1> and <h2> elements in the <style> element.
- Add the CSS to make just the <h1> element have a bottom border.
- Save and test "lounge.html" in the browser.
Exercise 3 [p.304-307]
- Read pages 297-307 of the Lesson.
- Create a new file in Notepad (File > New).
- Save it as "lounge.css" in your "lastname CSS" folder.
- Type, or copy-and-paste the CSS rules from your "lounge.html" file into your new "lounge.css" file. Do not copy the <style> and </style> tags.
- Save "lounge.css".
- Open "lounge.html" in Notepad.
- Delete the <style> element, including the <style> and </style> tags plus everything in between.
- Put in its place the <link> element which connects this page ("lounge.html") to your new external style sheet ("lounge.css").
<link type="text/css" rel="stylesheet" href="lounge.css" />
- Put the <link> element into the <head> for "elixir.html" and "directions.html" too.
- Save and test all three pages in the browser.
Exercise 4 [p.312-314]
- Read pages 308-315 of the Lesson.
- Open up "lounge.css" in Notepad.
- Add a new rule for the <body> element that makes it sans-serif.
- Delete the font-family property from the h1, h2 rule and the p rule.
- Add a new rule for the <em> element that sets the font-family to serif.
- Save and test "lounge.html" in the browser.
Exercise 5 [p.317-320]
- Read pages 316-320 of the Lesson.
- Open up "elixir.html" in Notepad.
- Add the class "greentea" to the first <p> element.
- Save "elixir.html".
- Open up "lounge.css" in Notepad.
- Add a new rule for a "greentea" class which makes the text green.
- Save "lounge.css". Test "elixir.html" in the browser.
Exercise 6 [p.327-329] - This is worth 40% of the grade!
- Read pages 321-331 of the Lesson.
- Open up the file "style.css" in Notepad (it is directly inside your "lastname CSS" folder.)
- This CSS file has eight errors in it. Locate and fix all the errors.
- Check "style.css" in W3C's CSS Validator (http://jigsaw.w3.org/css-validator/) .
- Check the stylesheet for the lounge ("lounge.css") in the validator too.
- Ignore the warnings, but fix any and all errors. Then retest. You're good if you don't see a red error badge across the top of your results.
Turn in Your Files
- In My Documents, navigate down into your root folder.
- Right-click on your "lastname CSS " folder and select Copy.
- Navigate to the Inbox.
- Right-click on the "CSS" folder and select Paste.
Source: "Head First HTML: with CSS & XHTML" by Elisabeth Freeman and Eric Freeman
