06. Using class

4 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
This is a free item
$0.00
د.إ0.00
Kz0.00
ARS$0.00
A$0.00
৳0.00
Лв0.00
Bs0.00
B$0.00
P0.00
CA$0.00
CHF 0.00
CLP$0.00
CN¥0.00
COP$0.00
₡0.00
Kč0.00
DKK kr0.00
RD$0.00
DA0.00
E£0.00
ብር0.00
€0.00
FJ$0.00
£0.00
Q0.00
GY$0.00
HK$0.00
L0.00
Ft0.00
₪0.00
₹0.00
ISK kr0.00
¥0.00
KSh0.00
₩0.00
DH0.00
L0.00
ден0.00
MOP$0.00
MX$0.00
RM0.00
N$0.00
₦0.00
C$0.00
NOK kr0.00
रु0.00
NZ$0.00
S/0.00
K0.00
₱0.00
₨0.00
zł0.00
₲0.00
L0.00
QR0.00
SAR0.00
SEK kr0.00
S$0.00
฿0.00
₺0.00
$U0.00
R0.00
ZK0.00
Already have an account? Log In

Transcript

In this session, let us learn how to use the class attribute of HTML using CSS. Whenever you want to apply styling to a particular HTML element, you use that element directly. That is, if you want to apply styling for a p tag, you use feedback. If you want to do styling for h1 or h2 tags, you use them directly as h1 or h2. What if you want to apply the same formatting to different types of tags? In that scenario, you need to go in for this class attribute of HTML.

How to use it in CSS, you think dot Have a look. I have used it over here as dot. Now I have got a p tag, a div tag, h1 and h2 if you will want to apply the same formatting to all these type of that can go in for using the class attribute of HTML. I have given class equal to check. So all the tags are going to have the same name, how to use it in CSS using this dot dot check, have a look dot check. And I'm trying to give the same background color and the font color to all these tabs.

Let me directly go to sublime and I will explain it from this tab HTML page with P do h1 and h2 tags have a look I have got to pee that one was classified reduce one without class attributes. Similarly for the h1 and h2. Now, let me start applying the style one by one. First that we do this do it for p tag for p let me give the background color as my be like no then same way For h1, let me give you the background colors. Green. Then h2.

Let me do the font color for h2. I'm going in for the font color as blue and I have a do also for them again let me give the background color as pink. Okay, this is that first let me open it in the browser open this file in the browser. Now I have kept the browser and Sublime Text side by side. Let us examine the output. All the P tags are having the background color is yellow, that bill tag having the background color is pink and the h1 tag having the background color is green and h2 tags having the font color or text color blue.

Now what I want is I want to give the same font I think for all the tasks which are having classes check, let me do that I am coming over here. Now I am just going to use dot check. Let me first start with text, transform and change everything to lowercase font style. I am changing it to italicize and let me give a color. Let me change the color as red and also I will increase the font weight to bold. Let me save this now.

Let me refresh that are having the class attributes are having the text transformed to lowercase. And then the font style is changed to atomic. The colors text colors change to red and the font weight is bold. Even for the last one for h2. Okay now when you want to apply the same formatting to different Going for the class attribute, give a value for the class attribute, use a 10 CSS using the dot operator the class attribute. Thank you.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.