I'm using SMACSS (Scalable and Module Architecture for CSS): http://smacss.com/
Specifically, I'm using Yahoo's Pure CSS (SMACSS) framework (just the Grids stylesheet): http://purecss.io/grids/
Is it correct to place a grid inside of a module?
For example, here is a grid inside of a 'foo' module. The foo module should show a row of three items.
<div class="foo">
<div class="pure-g">
<div class="pure-u-1-3 foo-thumbnail">Eat</div>
<div class="pure-u-1-3 foo-title">At</div>
<div class="pure-u-1-3 foo-description">Joes!</div>
</div>
</div>
OR, is it more inline with the SMACSS methodology to remove the grid from the module and write my own CSS to achieve the layout (instead of relying on the grid classes). For example:
<div class="foo">
<div class="foo-thumbnail">Eat</div>
<div class="foo-title">At</div>
<div class="foo-description">Joes!</div>
</div>
I faced the same question building one scale project. So the answer is no.
Because it will break the most important rule - its module independency. The right way is to use
module-mediator
. I had a similar task - to separate grid from modules, so I could arrange modules in columns. I created a module calledm-list
with elementsm-list-cell
.So in your case I would follow same way - inside the module I would use percentage geometry instead of
px
, and some mediator to set geometry to container with module.Here is an example:
Lets build LAYOUT. Let it be simple 2 columns page.
So next step - place N-column list inside main content area:
Now about m-list: Its our magic wand - its task separate area to columns:
You can checkout Foundation block grid. Its a great example of such mediator module