/* Bad */
.widget { }
#sidebar .widget { }
/* Good */
.widget { }
.widget-sidebar { }
In my opinion, it's best to use a "sidebar" class for the widget. .widget { }
.widget.sidebar { }
Now, you might be worried that the "sidebar" class affects the widget in unwanted ways. Well, it shouldn't. That class should have generic/basic styling that anything in the sidebar should have.Maybe you want to have special font styling for things in the sidebar. The ".widget.sidebar" is a special selector for a widget in the sidebar. You can also have the following
.separator
.separator.sidebar
.separator.footer
That makes elements easier to maintain and debug. Well, just my opinion.