Reputation: 4149
I have two css classes A and B that are applied on the same element. I want to change class A only when it has class B as its sibling. Is there any css selector that can do this?
Upvotes: 0
Views: 331
Reputation: 723428
You can apply styles to different classes as usual:
.A {
/* Styles for class A */
}
.B {
/* Styles for class B */
}
Then chain both classes to apply more styles to elements only with both classes:
.A.B {
/* Styles for elements with both classes A and B only */
}
Upvotes: 3