Reputation: 11125
For a structure like below
<div class="container">
<div class="headers">
<div class="header"></div>
<div class="header"></div>
...
</div>
<div class="contents">
<div class="content"></div>
<div class="content"></div>
...
</div>
</div>
I am applying a css style like below but seems the background color gets applied only to the headers and not the content(Style is applied during hover event)
.container .header,.content{background-color:#55bbee;font-weight:700;color:#fff}
I am certainly sure it's a mistake with the selector, but where is the mistake puzzles me.I could do this and work happily but how to do it in single line
.container .header{background-color:#55bbee;font-weight:700;color:#fff}
.container .content{background-color:#55bbee;font-weight:700;color:#fff}
Upvotes: 0
Views: 1593
Reputation: 201588
The code given works just fine, if you have some content in the elements so that any background is shown in the first place.
The problem is elsewhere, in the parts of code not shown.
Upvotes: 0
Reputation: 5442
.container .headers .header,
.container .contents .content{background-color:#55bbee;font-weight:700;color:#fff}
Upvotes: 0
Reputation: 1830
Of course:
.container .header, .container .content {background-color:#55bbee;font-weight:700;color:#fff}
Upvotes: 0
Reputation: 51634
As far as I know you can't group selectors. You have to reference .container
twice
.container .header, .container .content {
background-color:#55bbee; font-weight:700; color:#fff
}
Upvotes: 7