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 columnin a14-columngrid.to achieve this you should do a calculation like this.
Your
14-columnis now24-columnwhile nesting so5-columns in 14-columnsoccupying a space of35.174%.Considering24 columnsthat would be8.57 columnswhich 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 columnsi.e60/7in24 columnsyou should have that as a whole number giving you ..14*7 columns10*7 columsand5*7columnsYour grid should be
178-columnwith70-columnsto left and98-columnsto the right and35-columnsinside of98-columnsgrid.easier way write custom class for the 5 columns grid to occupy the
35.17%