Dale Doback
Dale Doback

Reputation: 97

Selecting active and hover in one declaration?

Hey guys how can I select :active and :hover pseudo classes in one declaration or is this not possible?

Here's what I have:

.hover-listing-btn:hover {
    color:#fff;
}

.hover-listing-btn:active {
    color:#fff;
}

Can I shorten that to one declaration?

I am using Bootstrap and it seems like that is quite a lot of CSS just for the sake of changing two selectors.

Is it possible?

Thanks

Upvotes: 0

Views: 63

Answers (1)

samy
samy

Reputation: 14962

You can separate both css declaration by a comma. It is not one declaration but at least you have only one css definition body

.hover-listing-btn:hover, .hover-listing-btn:active {
    color:#fff;
}

Upvotes: 1

Related Questions