You can add a second class to your main one <div>, which serves only to add the necessary background. Then, when you create the markup, you simply add a second class specifier in <div>if you need it, or omit it if you don't.
div.main {
}
div.mainbg {
background: *background-specifications*;
}
When your div menu is present, you use this:
<div class="main mainbg">
And when it is absent, you stick to:
<div class="main">
source
share