CSS grid and nested elements - css

Imagine you are using a CSS grid system and your page components are divs, snapped to the grid with a border radius.
If you wish to nest such components, the distance between the parent and child component must be at least a column width - right?
What if you want a smaller distance?
What if you want to nest up to 3 or 4 levels?
Any ideas?
Thanks

If you wish to nest such components, the distance between the parent
and child component must be at least a column width - right?
Why are using border radius to line up blocks/columns in a grid? Shouldn't you be using margins?
If you want to line things up in a grid, all grid columns must have a gutter.
What you're looking for in a CSS grid framework looks very much like 1KB Grid.
If you want more flexibility, you can use the Variable Grid System. From what you're proposing, there really isn't a need for you to use a custom grid or make a css grid framework.

Related

How to span partially in the specific css grid area?

I am new to CSS grid, I am planning to create the following layout with Grid rather than flex, but I am not able to find a way to use partial grid area. I also tried splitting into 8fr. Is it possible to do it with CSS grid? Fractions may change later on as well. Like instead of 1/3 space in the first row. It might change to 1/4, 1/4, 2/4.
Can someone let me know if it's possible to do it in one grid area or not? Thanks in advance.

How can I use Material UI React Grid (which utilizes CSS Flexbox) to have my items wrap, evenly spaced, but in a specific grid

In my React application I am using Material UI React. I'm trying to utilize the <Grid> component so that I can have 10 items in a flexbox.
I'm not sure what combination to properly use to get my items spaced out evenly in a perfect grid. When the items are a perfect grid (i.e. 10 items, 2 rows of 5), it works nicely. But as I change the screen size to account for responsive design, the rows are not perfect. The closest I can get is shown in the image, but I still want all of the items evenly spaced (not all that blank space to the right side).
Another attempt, which is definitely not what I want because of the last row:
try the justify={'space-between'} or justify={'space-around'} as a prop of the parent grid

Container and sidebar at right side

I am trying to achieve something, I want a main container and a sidebar at the rightside. which should deal with mobile layout as well, I was unable to find such thing or make it. The blue print is given in the image below. Thanks
BluePtint of what im trying to make
You can create this layout using div's with different ids or classes- your main body(red) could go in a div with class "#mainbody" and your sidebar(blue) would go in another div with class "#sidebar", then you can specify the dimensions in CSS.
Have you checked out a CSS framework like Bootstrap? Bootstrap makes it super easy to specify column widths with their grid system, so instead of having to state px or % width in CSS, you can add the class "col-md-3" to a column for a width of "3". Their system is based on units of 12, where 12 would be a full bar, 6 would be half etc: https://getbootstrap.com/docs/4.0/layout/grid/

The usage of block grid and reason of its existence in Foundation5

I recently found Foundation5 has Block Grid which has rarely found use case online anywhere to demostrate the importance of using it... or is it even a great function to have? Because I am currently using Bootstrap3 and found it does not have Block Grid. So I wonder if its really a big feature one should watch out for.
Maybe some critical user case that will be so much better to use Block Grid other than Column based Grid.
Thanks!
There are several differences between the block grid and regular column grid..
The block grid is always evenly spaced and distributed
The block grid requires less markup
The block grid doesn't have inner padding
Take a look at this demo: http://codeply.com/go/XiyFxtMcXT, and you'll see the differences. Notice how the block-grid evenly wraps the items when the items exceed one row.
Block grids give you a way to evenly split contents of a list within the grid. If you wanted to create a row of five images or paragraphs that need to stay evenly spaced no matter the screen size, the block grid is for you.
You could just as easily use a percentage based grid system to achieve the same result.
I think the benefit of the 'block grid' is:
Items are displayed in a 'ul' which will group them together (good, for accessibility).
It's quicker to add one style to a 'ul' that will automatically make each 'li' a 'column' than it is to add "col-x" to each 'li' manually
They've already built it so you don't need to.

Image does not horizontally line up with the text above and below it with 960 grid

Any idea why my image does not horizontally line up with the text above and below it please?
http://dl.dropbox.com/u/2306276/site/index.html
You're using a different class for the image element than for the text elements you want on the right column. Set the image's class to grid_13 (same as the text) and add push_3, so it moves 3 columns to the right.
It'd be better to rearrange your elements into divs though; otherwise you'll have to give each element specific properties, and that beats the purpose of using a grid system.
In the 960 Grid system, every nested class has to have a "grid_x". You div's in between ("Status" etc) which don't use the grid system, I imagine these are throwing it off.
Try adding grid classes to these, using "alpha" and "omega" where appropriate.

Resources