class attribute


The class attribute allows an element to be defined as belonging to a certain group or "class". This is normally used to assign properties to that element from a stylesheet, based on it's class.

This example sets the color for both the heading and the paragraph by setting the class attribute

      .redtext { color:red }
    <h1 class="redtext"> This heading is red </p>
    <p class="redtext"> This paragraph is red </p>