This is Sasha. Thanks for joining me here for another CSS tutorial. In this video, I want to share with you how to use classes. That way, of course, you can learn how to edit your business website a lot better. Let’s take a look at classes.
Structure of classes
The way that classes are done or structured is if you take a look at our current website and what we have here is we basically have H2 tags, H3 tags, and some paragraph tags. If I go ahead and want to target, let’s say, a few of these – let’s say, a few of these different elements over here.
I have the H2 tag and I have the H3 and then H2 over here. H2 tag is targeted right here with this color. Now if I really wanted this color within the – within a certain H2 tag but not the other one. What I could do is create a class. Let’s say both of these are green but I wanted one maybe red instead.
--------------------- HTML CODE --------------------------------------- CSS CODE ------------------ h2 { color:#3baf6e; } h2 {color:red;} p {font-size:17px;}Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting

How do we do that? Well, if I go to the second H2 tag and create another one and I do color and, let’s just say, it’s red, go ahead and hit save, now it actually changes both of them to red. That’s kind of a problem. The way that you do that is you do that by targeting with classes, okay?
If I want the second one to be red but the top one to be green, I could just go ahead and type in h2.green, okay? I could just create these names for myself. If I wanted it to be color1, I could do it that way too. Okay, so I’ll go ahead and hit color1. But you can see both of them are now actually back to green right there.

What you need to do is go ahead and input on that right here on the H2 tag style or actually class right here and you just go color1. You put the name here and you can see now I have one tag right here that’s green which is linked up to this and the second one that’s actually red, that’s linked up to this. You can see that they’re both linked together that one is targeting the other one.
--------------------- HTML CODE --------------------------------------- CSS CODE ------------------ h2 { color:#3baf6e; } h2.color1 {color:red;} p {font-size:17px;}Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting

Reusing CSS code with classes
One of the great things about CSS is that you can multi-reuse things. If I had color1 and I made it red, you know, I could just take off the H2 tag right there. Let’s say, I wanted to change maybe the product sales and profits right there or even these links right here or the bullets. Let’s go ahead and change it into the table. Let’s say, this product right there, I’ll go ahead and type in class and I’ll say, “Okay, this is color1.” Okay? Boom, right there, color1, and you can see the product got changed. I could go ahead and do the same thing to sales and profits.
--------------------- HTML CODE ------------------Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting
| Product | Sales # | Profits |
|---|---|---|
| Start Trading Stocks | 539 | $12,539 |
| Business Launch Pad | 109 | $1,132 |
| 100 Stock Trading Tips | 239 | $5,229 |

I’m reusing that code and you can see how powerful that is. If I wanted to change that all of a sudden to, let’s say, like a purplish color instead of red color, I could just go ahead and type in that color code right there and you can see it changes it to purple. It makes it really convenient and that way if you have like color2 or, let’s say, item style 2. Let’s just say we’re styling something different and I may want to go ahead just like using the text transform property. In the past, we did uppercase.
--------------------- HTML CODE ------------------Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting
| Product | Sales # | Profits |
|---|---|---|
| Start Trading Stocks | 539 | $12,539 |
| Business Launch Pad | 109 | $1,132 |
| 100 Stock Trading Tips | 239 | $5,229 |

Adding multiple classes
What I could do is add in multiple classes. I could say style2 to a few of these so as you look at this and, let me just save the stylesheet, you can see the product and the sales number is uppercase but not the profits. I could go ahead and add that to the profits as well if I wanted to. You could see and the same thing can happen with the start trading stocks like these books right there.
--------------------- HTML CODE ------------------Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting
| Product | Sales # | Profits |
|---|---|---|
| Start Trading Stocks | 539 | $12,539 |
| Business Launch Pad | 109 | $1,132 |
| 100 Stock Trading Tips | 239 | $5,229 |

If I just want to add in that text transform property, I could go ahead and do again a class style2 and you can see it right there, start trading stocks now is uppercase but it’s not purple. If I wanted it purple, I could go ahead and just say color1 and now you can see it’s purple there.
Classes and hierarchy
You can see how powerful this can really be as you start mixing and matching things. The only down side with this is if you go ahead and, let’s just say, I add like a hierarchy to it and I go ahead td.style2, it only affects the table column or row depending on what tag you put in right there to be able to do the transformed uppercase.you can see that in this case, the transformed doesn’t apply to the ones at the top or above on the heading because that’s a TH class.
--------------------- HTML CODE ------------------Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting
| Product | Sales # | Profits |
|---|---|---|
| Start Trading Stocks | 539 | $12,539 |
| Business Launch Pad | 109 | $1,132 |
| 100 Stock Trading Tips | 239 | $5,229 |

But on the TD class, it does apply because I’ve put the TD right in front of it, okay, with the style2. Okay? Let’s take that back off and you can see now it affects it for anything with the style2 but if I put a hierarchy, the same thing over here. If I do color1, let’s just go ahead and put it only on the TH tag, you’ll also noticed it’ll probably go away with that heading tag that we have right there. There, you can see. This is back to green and only affects the heading because that’s the table heading tag with that color.
You can see how we’re fine-tuning and targeting very specific areas with these classes and again you can have multiple classes. You can have five, 10 different classes. You could put in a size right here. If I wanted certain things to have sizes and I wanted a size element here, font size of, let’s say, 25 pixels, okay?
--------------------- HTML CODE ------------------Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting
| Product | Sales # | Profits |
|---|---|---|
| Start Trading Stocks | 539 | $12,539 |
| Business Launch Pad | 109 | $1,132 |
| 100 Stock Trading Tips | 239 | $5,229 |

I could go ahead and do that and now when you hit the refresh button you can see that anytime you target the size that one has those elements and I could something over here with the profits as well. Class, I’ll type in size and you can see it there. That number is also targeted and it has that size on that element.
That’s how you ultimately work with classes. You have to have that period in front. If you go ahead and put a tag in front of that firsthand that’s how it forces it to have that element. Now, there’s another little quick tip that I want to mention to you on this is that if you go ahead and have a space before the period, okay, so let’s say, I have a tr.color1 but I have a space, first let’s save it and let’s take a look.
If I have a TR, let me remove some of these. Okay, so now we’re targeting color1, let’s just see where the color1 is. We’re targeting the purple color and you can see where it is everywhere. If I go ahead and do TR which is table row and you can see it doesn’t affect anything there but if I go ahead and add a space, anything that’s first it’s looking for a table row and then anything with the color1, you can see that actually automatically changes it there. Okay?
--------------------- HTML CODE ------------------Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting
| Product | Sales # | Profits |
|---|---|---|
| Start Trading Stocks | 539 | $12,539 |
| Business Launch Pad | 109 | $1,132 |
| 100 Stock Trading Tips | 239 | $5,229 |

That’s ultimately anything with inside a table row with a color of 1 which if you look table row color1, all the headings would match up table row and even the TDs also would match up because there’s a color1 right there. That’s another way to do the hierarchy but if I put them together then it’s actually going to look for anything with the table of row with the color of 1 which as you can see nothing is there.
I would actually have to go ahead and add in a classes and then here color1, hit save and you can see there because that row is there, that would work.
--------------------- HTML CODE ------------------Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting
| Product | Sales # | Profits |
|---|---|---|
| Start Trading Stocks | 539 | $12,539 |
| Business Launch Pad | 109 | $1,132 |
| 100 Stock Trading Tips | 239 | $5,229 |

The period together would ultimately mean it has to be targeted for that specific element in that class but if you have a space it’s just looking for a hierarchy and this hierarchy can go pretty deep. As an example here, you can see that here we have – let’s remove this TR and I’ll show you.
Okay, if we have a TR and then we have – get rid of this TD, EM and then start trading stocks right there. Okay, so what could we do is go to TR, TD and EM with a color of 1. Okay? We’ll type in class color1, okay? You can see that this color1 right there works for the start trading stocks.
Let me zoom in right here. Okay, you can see it works for start trading stocks. But if I go ahead and type color1 anywhere else, let’s just say, in a paragraph tag class color1, you could see it doesn’t work because it’s looking first, it’s looking for a table or row then a table column then the EM tag with a color of 1 so that’s how that works.
--------------------- HTML CODE ------------------Backstageincome : Learn to grow a business and evolve your life! Welcome to My New Website!!!!!
Business Launch Pad is focused on showing you the critical concepts on how to build a profitable business from scratch.These are my books and products
Thank you for visiting
| Product | Sales # | Profits |
|---|---|---|
| Start Trading Stocks | 539 | $12,539 |
| Business Launch Pad | 109 | $1,132 |
| 100 Stock Trading Tips | 239 | $5,229 |

We’ll get more into this a little bit later as we get into nesting and defining hierarchies with inheritance properties. But you can see how the classes ultimately work and that’s really where the benefit is. When you have these classes, you can define things as colors. You can define things as margins.
Ultimately, it creates a really powerful way to reuse your CSS because you can do the same thing with font like font size 15 and define it as font size 15 pixels and then just reuse that throughout different pages.
I’ve seen people used that in all sorts of ways. It’s just a matter of how you write the code and how your website is set up and structured.