Flex and Grids

I was googling something and stumbled upon these resources →

  1. http://flexboxgrid.com/
  2. https://codepen.io/irinakramer/pen/jcLlp
  3. http://codepen.io/hucklesby/pen/ctGnv

Can we think this to be a kind of analog of bootstrap grid version, but in flex or flex-box?

I mean if we use such system then we can get the same desired result as in the bootstrap grid version?
(I mean the above examples can be used as a kind of framework.)

I think this is also using the Flex grid version →

The bootstrap grid itself these days uses flexbox, so yes they’re similiar! :wink:

There’s also CSS Grid but that’s not quite ready for prime time yet. Will be the future go to solution though.

3 Likes

Flexbox is better for aligning components that are within a grid rather than using flexbox as a full page layout although it can be used for this. Flexbox relies on content so you often see flexbox pages jumping around when they load until the content dictates the size the flex item needs to be. I don’t see this an issue but clients tend to complain about this.

Flexbox unlike display:table and table-cells (or the new grid system) cannot create a relationship between rows and columns so is only another tool in the toolbox and not the overall solution. The new grid layout will be the ‘de facto’ tool for layout but will still need flexbox for components inside the grid to make them flex and adapt as required but within the specifications of the grid.

Grid layout will be its own grid so don’t use a framework for it. If you are going to use a framework for flexbox then please learn how to use flexbox first. Once you’ve learned flexbox you will find you don’t need the support of a framework anyway. :slight_smile:

9 Likes

This is a million dollars response, and it has eliminated many of my decision points where I was struggling from last many days.

I have a question
Reference Page Link Here.

Now I have pointed 3 arrows here. Do you think that all this is a grid I means all those 3 boxes are Flex Grids, Right?
I mean it is not a 2 column layout, but a FLEX GRID. Right?

By the way i am learning flex from these free resource these days →

I don’t see any need for flex there. It’s a 2 column layout which can be done width the display:table and table-cell properties and be supported back to IE8. It can also be done with flex if older support is not required but doesn’t specifically have to be a flexbox layout,

If the items in your right column needed to flex so that no matter how many items you had they matched the height of the left column then yes you would need flex. If you are just stacking content in a column and not wanting it to keep track of the left column then you don’t need flex but of course you could still use it…

If you want to re-order the columns for small screen then you would need flex but of course you could just add the flex rule once you have resorted to a single column in your media queries anyway.

If you have a specific html source order but you want the elements in different positions then yes you do need flex.

It all depends on what your criteria are and whether you are supporting modern browsers or not.

Remember that a lot of the time there is no right or wrong (within reason) but the method you use does depend on the criteria that you set for your design and what you want to happen next.

3 Likes

Yes I saw that a while ago and its a good resource.

1 Like

Sir, You are brilliant not because you know web development at an expert level, but how easily you understand the person’s mind, and what mental hurdle or confusion the person is facing at the moment. Yes you are right sir →

If the items in your right column needed to flex so that no matter how many items you had they matched the height of the left column then yes you would need flex.

1 Like

http://caniuse.com/#search=flex

i think flex supports all he browsers.

I think this is somewhat closer to what we had in that freelancer.com website →
http://codepen.io/donebydavid/pen/dMoyMj

Please correct me If I am wrong. If we eliminate Card 3 - Card 6 → we will get the same grid structure, but as far as I know grids are quite flexible, but in the codepen link that I shared don’t you think so that the codepen that I shared defies the idea of grid because grids are self adjusting and here they are setting them right and left or this ok, and is quiet common in web development world.

This use of flex makes no sense at all.
It is a totally rigid layout made up of fixed size elements. It is 100% not responsive.
So although the line display: flex does appear in the css, it may as well not be there because it’s not being used at all because you fill the flex container with inflexible elements. :upside_down:
Concrete in a jelly mould.

What is wrong?
This:-

  width: 650px;
  height: 280px;

This is exactly how not to do RWD. Avoid fixed widths, totally avoid fixed heights.
Keep things fluid and let content dictate the size.

1 Like

Ok sir, if we convert them into %age then do you think we are good? I think the penmakers set some height in order to demonstrate the things. this is just my point of View.

Do you have other pen as suggestion if this is not a good one.

This is a fork of the pen with the fixed sizes removed.
Not perfect, as I’m not sure of the intended behaviour, but it’s much more flexible now.
http://codepen.io/SamA74/pen/RpBeeK

People often do that with demos, but it’s not necessarily representative of a real world page with real content.

1 Like

Sire, I have to replicae the page model like this →

Reason why I need Flex?
As Mr PaulOB said →

I think this is the catch, everything is so fluid now →
.left .box1

In your design the “right” seems to be rigidly fixed. should I also set max-width for “right” or that wont be a correct way. I mean what If I have to increase the width of the “right”?

Often there is no correct or incorrect way. It comes down to what works to make the desired behaviour, which is something I can only guess at.
In the example I use the flex shorthand property for grow shrink and basis to infer sizes without rigidly defining them. This allows for a quite flexible, fluid layout without the need for media queries. That is the beauty of flex.

4 Likes

<off topic>

The vids are not close captioned and there is no e-mail method of contacting the author. Must use social media. No apparent way to avoid mailing lists. May as well be a strike-out.

That’s the brakes. (sic)


</off topic>

1 Like

I think he is currently building the community and you can reach him at his twitter →

  1. https://twitter.com/wesbos
  2. or you can contact him here → http://wesbos.com/contact/
1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.