Using more than one CSS classes for an element in HTML

HTMLWeb DevelopmentFront End Technology

To add more than one CSS classes, you need to use the class attribute in HTML.

Example

You can try to run the following code to learn how to implement more than one CSS classes for an element in HTML −

<!DOCTYPE html>
<html>
   <head>
      <style>
         h2.myClass1 {
            background-color: black
         }
         .myClass2 {
            color: red;
         }
      </style>
   </head>
   <body>
      <h2 class = "myClass1 myClass2">Tutorialspoint</h2>
      <h3>Simply Easy Learning</h3>
   </body>
</html>
raja
Published on 13-Mar-2018 05:58:17
Advertisements