Multiple CSS Class

Multiple classes can be applied to a single element in HTML and they can be styled using CSS.

But the concepts used in assigning two classes can be extended to multiple classes as well.

NOTE: The names of the classes must be separated by a space

To Understand Multiple CSS Class see the below

<tag_name class=”class_1 class_2″>

Then the classes can be either styled individually using “.class_1” and “.class_2” or that element could be styled only that contains both of the classes using “.class_1.class_2“.

Example Given Below

Exercise 9.1

This webpage has three images in the body, but there are no styles yet.

 

We’ve defined a few CSS rules with class selectors at the top. Some of the rules change the size of the image, and others change the border.

 

Your challenge: is to add two class names to each image so that the sizes and borders vary from each other. Mix and match – try a few out!