(You don't need a sketch for this assignment.) Today we're going to start playing with style sheets. Style sheets are a very powerful tool if used properly. They allow you to change your style in one place Follow the directions below to create each of the paragraphs shown. This will (hopefully) give you a clearer idea how to use CSS style sheets.
- Create a folder. Call it something like Using CSS.
- Open Notepad.
- Save your Notepad file as stylesheet.css. Save it in the folder you created.
- Open Notepad again.
- In your folder save your file as index.html.
- At the top of your file type <html>
- Then hit enter and type <head>
- Next hit enter and on that line type <link rel="stylesheet" type="text/css" href="stylesheet.css" />
- Then hit enter and type </head>
- Save your file.
- You have created two different files; one is called index.html. One is called stylesheet.css/
- Now go back to your file called stylesheet.css.
- Type in p{color:red;}
- Save your file.
- Now go back to your file called index.html
- Start a new paragraph like this one. <p> I am so very, very cool.</p>
- Save your file.
- Find your file in your part on the server.
- Double click on it.
- It should open up in your browser and you should have a paragraph like the one below. The text should be red and the background color should not change.
I am so very, very cool.
- Go back to your stylesheet.css file and change the information about your paragraph.
- Add one line like this: p{color:red; background-color:blue}
- Save your index.html file.
- Reload your browser.
- Your paragraph should look like the one below.
- Now make another change to your paragraph information in your stylesheet.css file.
- Your new like should read: p{color:red; background-color:blue; text-align:right}
- Save your stylesheet.css file.
- In your browser reload your file.
- Once more your paragraph should change and your text should jump to the right.
- Pretty, isn't it?
- Go back to your stylesheet.css and add another change to your paragraph information.
- Let's move that back where it belongs. Take out the "text-align:right" command like so: p{color:red; background-color:blue;}
- Your new like should read: p{color:red; background-color:blue; text-decoration:line-through;}
- Save your file and reload in your browswer.
- Admire your nice new effect.
- Okay, now that crossing out thing doesn't look so good, does it? Take that part out of your paragraph instructions.
- Now your information looks like this: p{color:red; background-color:blue;}
- Let's make everything capitalized. Add one new command like this: p{color:red; background-color:blue; text-transform:uppercase;}
- That was fun, wasn't it? Now change the font like this:
- p{color:red; background-color:blue; text-transform:uppercase; font-family:"Georgia";}
- Now let's set a very simple border for your paragraph like this.
- p{color:red; background-color:blue; text-transform:uppercase; font-family:Georgia; border-style:dotted}
- This should give you a red dotted line around your paragraph.
Your assignment
- Now create a webpage with a style sheet. All of the following items should be done using a style sheet. You should have:
- Green text
- A blue background for the text
- A Verdana font
- A dashed border
- Underlined text (using the style sheet)
- Text that's right justified.
|
 Updating...
ĉ James Dykstra, Dec 11, 2012, 8:11 AM
|