Exercise 8 Demo: Part F : IDs
CSS: Using IDs to Define Styles
We learned in Exercise 4 that we can use the ID attribute to accurately pinpoint a place to jump to on a page. Each time we use the ID attribute on a page - it needs a different name. In other words - each ID is unique. We can also use the ID attribute to identify unique sections of our webpage that we want to apply specific styles to.
Remember use a hash mark # to identify an ID. Name them the same way you would a class - in other words - give them a name that makes sense with what they are identifying.
If you are using an id to identify and style the information in your footer area - you might use the name foot. (you can do this in your external style sheet or your internal document styles in the head of your web page)
#foot {font-family: arial, sans-serif;
font-size: 11px;
text-align: center;
color: #666666;
}
When you go to your page to use the id - the code would look like this:
<p id="foot"> Site copyright 2009. All rights reserved. </p>
Site copyright 2009. All rights reserved.
There are many more CSS styles to play with. Have fun!
Review Basic Classes? Go to Part D of Demo 8.
Back to Inline Styles? Go to Part C of Demo 8.
Back to Document Styles? Go to Part B of Demo 8.
Review External Style Sheets go to Part A of Demo 8.
See a demo of DIVs and CSS Navigation
Go to the Exercise 8 page.
© Claudia Faulk. Created in 2008. Updated 1.10