Lab #4 XHTML and CSS

(due Tuesday, 1/27, 11:59 PM)

CSS


Now we're going to use CSS to style your web page. CSS is capable of some really fancy stuff, but in this course, we will only do some basic styling.

1. Open a new text file and copy the following into the file:

a {
    text-decoration: line-through;
    color: red;
}

body {
    font-family: sans-serif;
}

h1 {
    font-size: 60px;
    background-color: #FFFF00;
}

2. Save the file as style.css. This file should be in the same directory as your XHTML file.

3. In your XHTML file, add the following line within the head tags:

<link rel="stylesheet" type="text/css" href="style.css" />
It will look something like:
<head>
  <title>My Web Page!</title>
  <link rel="stylesheet" type="text/css" href="style.css" />
</head>

4. Reload your web page and notice what changed.

For information about what properties are available to you, check out the reference pages:

(Optional) If you want to know how to make links change style when you put your mouse over them (like the links on this page), see this tutorial.

previous page   next page