CSS can address or select elements on a page in many different ways. Some of the most common ways are as follows:
body{ font-family: Arial; }
.important{ font-family: Arial; }
#top{ font-family: Arial; }
Note: If I want to do the same thing to a couple of elements I can add those add more elements to my selector with a comma seperating them. For example, if I want to update all my heading levels to be in Verdana, I would write the following:
h1, h2, h3, h4, h5, h6 { font-family:Verdana; }Element, ID, and Class selectors can be combined with a space seperating them to get really specific about the elements you want to apply style to. For example, if I want to style the list items in my navigation differently than the other list items on my site, I can give my navigation opening tag a class attribute and combine class and element selectors in my CSS. Here is what my HTML could be:
<nav class='main-nav'> <ul> <li><a href='about'.html>about</a></li> </ul> </nav>And here is what my CSS would be:
.main-nav li{ padding:2%; }Next: Element Spacing