How to: Have Multiple Classes

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
Share on email

Here i will show you an example of how to define a tag with multiple different classes.


<h2 class=”city main”>Example 1</h2>
<h2 class=”city”>Example 2</h2>
<h2 class=”city”>Example 3</h2>


By using the following examples, you can see that example 1 has 2 words in the class unlike the other 2 examples. By doing this, it allows you to separate the two different classes. You can define class “city” and give it a background color of blue, but by using the class “main” you can define that specific example. For example, if you wanted to center the text or change the text color, you can define it with the “main” class.