CSS: / Home / ClassSelector

The Class Selector

  <head>
    <title>The Style Element</title>
    <meta charset="utf-8" />
    <style>
      .button {
        display: inline-block;
        background: lightsteelblue;
        border-radius: 4px;
        padding: 5px;
        text-decoration: none;
      }
    </style>
  </head>

A Class selector defines the group of elements to which the style properties are applied.

A Class selector name starts with a dot ".".

Using the above ".button" rule example; only those elements that are qualified with the attribute (class="button") will use the .button class style properties.

<- ElementSelector            IDSelector ->
5ClassSelector