I found this information on stackoverflow.com: basically if you have a style that you need to apply to more than one element, use the class. If it's something like a header that will be used only once, you can use the div id.
code in the webpage:
This will be red.
this will be blue.
code in the CSS file
#myRedText
{
color: red;
}
.blueText
{
color: blue;
}