I'm strugling a bit with some custom 960.gs classes that I'm using. Problem occurs when I'm using a sub-container, and the sub-container's column simply inherits the width from the main-container's column rules.
In my opinion the inner cells (foo + bar) should be green. Meaning they should get the rules of .container-6 .grid-3
instead of .container-8 .grid-3
I'm aware of the !important
option in CSS, but I would like to investigate other options first, because that would be a problem if the situation was the other way around.
HTML
<div class="container-8">
<div class="grid-3">
<div class="container-6">
<div class="grid-3 alpha">foo</div>
<div class="grid-3 omega">bar</div>
</div>
</div>
<div class="grid-5">test
</div>
</div>
CSS
body {
min-width: 990px;
}
div {
padding: 5px 0;
}
.container-6 {
margin-left: auto;
margin-right: auto;
border: 1px solid yellow;
width: 684px;
}
.container-6 .grid-3 {
width:312px;
border: 1px solid green;
}
.container-8 {
margin-left: auto;
margin-right: auto;
width: 960px;
border: 1px solid silver;
}
.container-8 .grid-3 {
width:340px;
border: 1px solid blue;
}
.container-8 .grid-5 {
width:580px;
border: 1px solid red;
}
.alpha {
margin-left: 0 !important;
}
.omega {
margin-right: 0 !important;
}
.grid-1,
.grid-2,
.grid-3,
.grid-4,
.grid-5,
.grid-6,
.grid-7,
.grid-8 {
display:inline;
float: left;
position: relative;
}
I have made this fiddle to illustrate my problem. I have taken out the non-related 960.gs rules.
In my opinion the inner cells (foo + bar) should be green. Meaning they should get the rules of .container-6 .grid-3
instead of .container-8 .grid-3