Oskar Borbas
Oskar Borbas

Reputation: 13

Simplify same css for multiple different classes?

I'm a newbie, and I spent a lot to find answer but I think I didn't search correctly.

How do I write this in one line?

.black h1 {
   color: #ffffff !important;
}
.black h2 {
   color: #ffffff !important;
}
.black h3 {
   color: #ffffff !important;
}
.black p {
   color: #ffffff !important;
}

Thanks In advance

Upvotes: 1

Views: 40

Answers (3)

Raphael Guimarães
Raphael Guimarães

Reputation: 124

If you want specify only these elements

.black h1, .black h2, .black h3, .black p { color: #fff; !important; }

But if you want all elements inside this class

.black * { color: #fff !important; }

Upvotes: 1

IsraGab
IsraGab

Reputation: 5175

By a coma:

.black h1, .black h2, .black h3, .black p {
   color: #ffffff !important;
}

Upvotes: 1

smrubin
smrubin

Reputation: 551

.black h1, .black h2, .black h3, .black p {
   color: #fff !important;
}

Upvotes: 2

Related Questions