Snowcrash
Snowcrash

Reputation: 86337

How are CSS elements combined

I've got several CSS elements that I'd like to group.

At the moment I'm using:

.elementA {
    padding: 3px;
}

.elementB {
    padding: 3px;
}

I'd like to combine them into one rule to avoid repeating stuff over and over again. E.g.

.elementA and .elementB {
    padding: 3px;
}

How do you do this?

Upvotes: 2

Views: 78

Answers (7)

NullPoiиteя
NullPoiиteя

Reputation: 57332

.elementA, .elementB {
    padding: 3px;
}

by comma separator , you can combine

Upvotes: 4

Evandro Silva
Evandro Silva

Reputation: 1402

Use the comma (,)

.elementA, .elementB {
    padding: 3px;
}

Upvotes: 1

Akhil Thayyil
Akhil Thayyil

Reputation: 9413

Try this

.elementA,.elementB {
    padding: 3px;
}

Reference http://www.smileycat.com/miaow/archives/000152.php

Upvotes: 2

m.piras
m.piras

Reputation: 420

Just separate your classes with a comma

.elementA, .elementB {
    padding: 3px;
}

Upvotes: 1

Rohit Azad Malik
Rohit Azad Malik

Reputation: 32202

uSed to this

.elementA, .elementB{
    padding: 3px;
}

Used the (,) Comma

Upvotes: 1

silentw
silentw

Reputation: 4885

.elementA, .elementB { padding: 3px; }

The comma is the combiner.

Upvotes: 2

Danil Speransky
Danil Speransky

Reputation: 30473

.elementA, .elementB {
    padding: 3px;
}

Upvotes: 1

Related Questions