I don't understand grid nesting in (any of) CSS frameworks.
I'm using Foundation CSS framework with 24 colum grid — one column = 4.16667%, two — 8.33333%, twelve — 50%, etc.
This is my grid for 1920 pixel browser width — left part = 10 columns (41.66667%), right part = 14 columns (58.33333%) — Codepen.
Inside the right part there is a heading and a content block:
Heading has 1 column padding (in Foundation it is called «push»):
<div class="row small-padding-horizontal-1 medium-padding-horizontal-1 large-padding-horizontal-1 xlarge-padding-horizontal-1 xxlarge-padding-horizontal-1">…</div>
— as you see on the attached image heading does not fit the grid.
Content block is 5 columns wide:
<div class="small-5 medium-5 large-5 xlarge-5 xxlarge-5">…</div>
— as you see on the attached image this block does not fit the grid — it is not 5 columns wide.
And this is absolutely right and obvious — right block is 58.33333% wide, so all inner blocks' width percents will calculate accordingly this block width, not whole window width.
My question is — how do I fit the grid for my nested blocks which are inside parent blocks?
Responsive frameworks work with % width of parent divs..
Calculating according to your needs is a little bit trickier and messy at times.
If you look at your requirement you want to fit
5 column
in a14-column
grid.to achieve this you should do a calculation like this.
Your
14-column
is now24-column
while nesting so5-columns in 14-columns
occupying a space of35.174%
.Considering24 columns
that would be8.57 columns
which is not a whole number so choose the one that is closest to it ( 8 or 9 columns).But if you want to exactly have
5 in 14 columns
i.e60/7
in24 columns
you should have that as a whole number giving you ..14*7 columns
10*7 colums
and5*7columns
Your grid should be
178-column
with70-columns
to left and98-columns
to the right and35-columns
inside of98-columns
grid.easier way write custom class for the 5 columns grid to occupy the
35.17%