Goal
The goal of this tutorial is to know how use classes in CSS and HTML
Syntax
You can use classes in CSS to select different elements at same time.
<p class="greenText">Hello World</p>To get these elements from CSS you have to write the name of the class starting with a dot ( . ):
.greenText{
color: green;
}Now all the properties inside the class greenText are applied to the elements with this class.
<p class="greenText">Hello World</p>
<span class="greenText"> Hello again</span>Trick
If you want to use more than one class in an element is as simple as put a space between them.
<p class="firstClass secondClass">Hello World</p>Conclusion
Try to use all the classes that you need instead id’s. You’ll thank me in the future.