CSS Training Exercises

Kevin Lawver

This is a presentation. If you'd like to view all the slides like a normal web page, you can.

Training Exercises: Part One

Training Exercises: A "Clean" Slate

Training Exercise: Positioning

Training Exercise: Lists

Training Exercise: Background

Training Exercise Two: The Header

Training Exercise Two: Your Markup

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>Header Example</title></head>
<body>

<div id="head">
    <h1>AOL</h1>
    <form action="/search" method="GET">
        <fieldset>
            <input type="text" name="query" class="searchbox"/>
            <input type="submit" value="search" class="button"/>
        </fieldset>
    </form>
    <ul id="nav">
        <li><a href="#">Main</a></li>
        <li><a href="#">News</a></li>
        <li><a href="#">Entertainment</a></li>
        <li><a href="#">Personal Finance</a></li>
        <li><a href="#">Local</a></li>
        <li><a href="#">Games</a></li>
    </ul>
</div>
<div id="foot">Copyright 2005 America Online</div>
</body></html>

Training Exercise Two: Your Pieces

Training Exercise Two: CSS For the Heading

body {
  margin:0;
  padding:0;
  font: 77% tahoma, verdana, arial, sans-serif;
  color:#000;
}
	
#head * {
  margin:0;
  padding:0;
}
	
#head {
  background: #3D84BC url('gradient.gif') repeat-x top left;
  height: 128px;
}
	
#head h1 {
  float:left;
  height:106px;
  width:170px;
  text-indent:-1000px;
  overflow:hidden;
  background: url('logo.gif') no-repeat 9px 18px;
}

Training Exercise Two: CSS For The Form

#head form {
  margin: 0 0 0 171px;
  padding:35px 0 0 0;
}

#head form fieldset {
  width: 420px;
  padding:3px;
  border:solid 1px #3D84BC;
  background:#B7DEFD;
}

#head form input.searchbox {
  width:360px;
}

Training Exercise Two: CSS For The Nav List

#nav {
  clear:left;
  height:1.8em;
  list-style:none;
  background: #b7defd;
  border-bottom: solid 1px #3d84bc;
  padding:0 0 0 10px;
}
	
#nav li {
  float:left;
}
	
#nav li a {
  display:block;
  padding: .3em 10px .2em .2em;
  background:#b7defd;
  color:#3d84bc;
  text-decoration:none;
}
	
#nav li a:hover {
  color:#009;
}

category: Presentations, CSS