Hands On Practice 3.4 Exercise

Click Here to View Finished Exercise

 


Chapter 3

Configuring Color and Text with CSS

Hands On Practice 3.4 P.92

In this exercise I learned about Classes and Id Selectors. For a Class you place a dot right before the name. For an Id Selector you place a number sign in front of the name. When applying a Class or an Id in the body of the web page you do not put these symbols in front of the name. When you would like to apply CSS to any element rather than any specific tag you would use a class selector. If you have a specific area in mind on a web page that you would like to apply CSS to it is recommended to use an Id selector over a class. For example, the footer in this case. All I did was added on to the code presented in the previous exercise Hands On Practice 3.3. I added a class called "nav" and an Id called "footer". Please see code below. The part that I added on is in red.

<style type="text/css">

body { background-color: #E6E6FA;
color: #191970;
font-family: Arial, Verdana, sans-serif;
}

h1 { background-color: #191970;
color: #E6E6FA;
line-height: 200%;
font-family: Georgia, "Times New Roman", Times, serif;
}

h2 { background-color: #AEAED4;
color: #191970;
font-family: Georgia, "Times New Roman", Times, serif;
}

p { font-size: .90em; }

ul { font-weight: bold; }

.nav { font-weight: bold;
font-size: 1.25em;
}


#footer { font-size: .75em;
font-style: italic;
}


</style>