The selectors you can use depends on what you want to do.
.entry {}
will apply to the class in both containers. Any CSS share between the two should be added in the simple selector, which should be listed in your CSS.
From there, if you want to customize either column, or have CSS that only applys to one column, but not the other, you can use either #content-sidebar .entry{}
or #content-nosidebar .entry{}
.
If there are other places that you have an .entry
class, and you want CSS that applies to both #content-sidebar
and #content-sidebar
, you can use the combined selector #content-sidebar .entry, #content-nosidebar .entry{}
. In this context, it might make more sense to add a common class of .content
to #content-sidebar
and #content-nosidebar
. This would allow you to use a selector of .content .entry
, instead of having to shove those IDs into all your CSS.
<div id="content-sidebar" class="content">
<div class="entry"></div>
<div class="sidebar">Sidebar Content</div>
</div>
<div id="content-nosidebar" class="content">
<div class="entry"></div>
</div>
The CSS would make the most sense in the following order:
.entry {
/** CSS common to all .entry elements **/
}
.content .entry {
/** CSS common to all .entry element in all .content areas **/
}
#content-sidebar .entry,
#content-nosidebar .entry{
/** CSS common to .entry elements inside #content-sidebar and #content-nosidebar **/
}
#content-sidebar .entry{
/** CSS specifically for .entry elements inside #content-sidebar **/
}
#content-nosidebar .entry{
/** CSS specifically for .entry elements inside #content-nosidebar **/
}
The reason you build your CSS this was is for
- Efficiency - Common CSS is applied globally instead of repeated
multiple times thoughout the CSS
- Organization - Common CSS is listed
first, while more specific CSS for specific sections are grouped and
listed afterwards, dispute the CSS specificity of the selectors
making the order irrelevant.
Good luck out there. -Matt