Timsen
Timsen

Reputation: 4126

How to write multiple css selectors in one line?

My problem is that i want to write this in single selection :

.btn-primary > i.glyphicon {
    color: #ffffff;
}
.btn-primary > span.glyphicon {
    color: #ffffff;
}

But this :

.btn-primary > i.glyphicon, span.glyphicon {
    color: #ffffff;
}

doesnt work. Because all the span.glyphicon tags are geting white color. How do solve this?

Upvotes: 4

Views: 7903

Answers (1)

GreyRoofPigeon
GreyRoofPigeon

Reputation: 18123

Comma separate them:

.btn-primary > i.glyphicon,
.btn-primary > span.glyphicon {
    color: #ffffff;
}

More info can be found at w3.org about grouping.

If you want to 'shortcut' them, you'll need a CSS pre-processor, like SCSS or SASS.

Upvotes: 10

Related Questions