Class Selector
.The class selector selects elements with a
specific class attribute.
To select elements with a specific class,
write a period () character, followed by the
name of the class:
In the example below, all HTML elements
with class="center" will be center-
aligned:
Example:
.center{
text-align: center;
color: red;
You can also specify that only specific
HTML elements should be affected by a
class. In the example below, all <p>
elements with class="center" will be
center-aligned:
Example
p.center{
text-align: center;
Color: red;
}