The class attribute is used to indicate a class name in a stylesheet. It can also be used by JavaScript to access and manage elements.


<tag class="name_of_class"></tag>


<!DOCTYPE html>
                font-size: 22px;
        <div class="class1">Hello World!</div>


  • Look this line of code <div class="class1">Hello World!</div>
  • You can define multiple <div class="class1 class2 class3 ..... .........">Hello World!</div>
  • The class attribute can be used on any HTML element.
  • he class name is case sensitive!