Class vs. Id selectors
To give an element a class, you will write class="name of your class" your HTML could look like
<div class="meat">This is meat</div>
This div layer/element follows any rule you declared for the class "meat".
<div class="meat">This is meat</div>
This div layer/element follows any rule you declared for the class "meat".
Class selectors always have a period placed before the class name. The reason for this is the way elements are called by the DOM. DOM stands for Document Object Model and it is the hierarchical tree order of HTML elements on a page. The reason for the period is that classes are appended to an element, for instance, in the movie above,
the class meat is appended to div. It can also be written:
div.meat
In this case div.meat is the same as .meat.
the class meat is appended to div. It can also be written:
div.meat
In this case div.meat is the same as .meat.
To give an element an id, you will write id="name of your id" your HTML could look like
<div id="redmeat">This is red meat</div>
This div layer/element follows any rule you declared for the id "redmeat".
<div id="redmeat">This is red meat</div>
This div layer/element follows any rule you declared for the id "redmeat".