Why I use grid over flexbox for this common layout

Поділитися
Вставка
  • Опубліковано 5 січ 2025

КОМЕНТАРІ •

  • @KevinPowell
    @KevinPowell  2 роки тому +150

    box-sizing: border-box won't change this, as some comments have asked about. I had this in my code and should have shown it, but as I did show, flexbox is looking at the content-size, and not the box-size, so it doesn't have an influence here.

    • @baphometgaming1056
      @baphometgaming1056 2 роки тому +3

      Honestly, im not even a web dev but been lurking around for some time trying to get into web dev and im surprised it took You this long to actually prefer grid over flex for such things. Much love Kevin!

    • @Rowan11088
      @Rowan11088 2 роки тому +4

      Interestingly, if you have box-sizing: border-box AND add a flex-basis for the inner items of, say, 20%, they WILL all size the same. But if you use a flex-basis of 100% (which I'll often do if I don't know how many items will be present), it makes the middle one larger. I thought I understood flexbox pretty well - not sure what to make of this!

    • @velkanalpha
      @velkanalpha 2 роки тому +1

      exactly the reason for me enter the comments😄. Good Video

    • @evanoffhandson7067
      @evanoffhandson7067 Рік тому

      Thank you for joining the front ends in this corner of the internet@@baphometgaming1056

  • @PhilLesh69
    @PhilLesh69 2 роки тому +86

    The lightbulb went on for me once you explained that flexbox uses the content size instead of box size. It had never occurred to me that the browser rendered each using distinct sizing rules. I had just sort of operated under the assumption that everything was like the box model starting from margin, to padding then to content, and never gave it more thought than that.

    • @chrisstucker1813
      @chrisstucker1813 Рік тому +6

      CSS is a nasty beast. You could go years without ever realising this and one day you’ll be scratching your head for hours upon hours, wondering why an even-sized box-alignment isn’t working like it always has before just because you added some padding. And then, with luck, you’ll stumble across this video and immediately proceed to punch yourself in face multiple times.

  • @Pesthuf
    @Pesthuf 2 роки тому +98

    This "Flexbox for 1-dimensional, Grid for 2-dimensional layouts" myth has been echoing around the web for way too long.
    Thank you for making this video. Grid is amazing.

    • @homan-awa
      @homan-awa 2 роки тому +6

      Alright, time to use 3-dimensional layouts😂

    • @levsonc
      @levsonc 2 роки тому +8

      It's not myth, that is still true. But yeah, grid treat width not like flexbox. Flexbox distributes free space, it's about packing things (like toolbars, where it originates from). Grid is for-well-setting a grid, more about organizing space. It's a different approach and a slightly different task.

    • @pegeeeeee
      @pegeeeeee 2 роки тому

      @@homan-awa threejs?

    • @godnyx117
      @godnyx117 Рік тому

      @@levsonc Amazing comment!

    • @gbbarn
      @gbbarn 11 місяців тому

      Flexbox is the way.

  • @TheCocoaDaddy
    @TheCocoaDaddy 2 роки тому +5

    Man, how do you master all this? I mean not only do you clearly understand this and know what you're doing, you're able to explain things in a manner that's easy to understand and digest! I loved (and finally finished) your responsive layouts course and I need to take ALL of your courses. lol Thanks for posting!!!!

    • @marcosfavarao938
      @marcosfavarao938 11 місяців тому

      man, How can i get this course? Where can i watch? Do you have a link?

    • @TheCocoaDaddy
      @TheCocoaDaddy 11 місяців тому

      @@marcosfavarao938 Do a web search on "Kevin Powell responsive design course" and you'll find a link to the "Conquering Responsive layouts", i think it's called, course. It's absolutely EXCELLENT and HIGHLY recommended!

  • @duncan9992
    @duncan9992 2 роки тому +1

    Responsive equal grid in 2 lines of CSS (no media queries):
    {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    }
    The min() inside the minmax() is the key component here, so when the screen size drops below the px value, the columns will be 100% of the container, otherwise they'd just overflow when they reached the threshold.
    Can obviously use a gap too and change auto-fit to auto-fill depending on use case, but I use this all the time on projects and saves a lot of time!

  • @siriusgd4753
    @siriusgd4753 2 роки тому +5

    As always you are a wonderful teacher. I come from the old school of procedural programming from before the internet and the whole DOM box model kills me. It's not my worst struggle but it is at times but thanks to you I have solved many problems. I used to pay but I'm on SS now and only do this to keep me sane. LOL! I just read what I wrote.

  • @rafaelcipriano6287
    @rafaelcipriano6287 2 роки тому +1

    Hello Kevin, I'm Brazilian and every things has more simple, when I watch your videos. All your content it's amazing, please never stop to do your videos because I need them. I'm learning english during at this time and I expect learn much more with you about Web Development.

  • @frankiefab
    @frankiefab 2 роки тому +1

    I'm a big fan of CSS grid. Thank you for the tips Kelvin.

  • @theodorealenas3171
    @theodorealenas3171 2 роки тому +1

    Reading comments in front end videos is so relaxing compared to comments on technical videos. I might not be a fan of front end but everything is so clean and happy.

  • @peng_edits
    @peng_edits 2 роки тому

    Oh my god you cant believe how much this video helps me! Even if i learn from every of your videos, this one solves so many issues i had. I had them because flexbox was the first thing i learned, or at least it was what is used every single time since i started with CSS.

  • @rpf23543
    @rpf23543 2 роки тому +7

    Thanks Kevin, as usual, awesome content, very helpful!!

  • @yakupjs
    @yakupjs 2 роки тому +1

    I had the same problem with padding three days ago. I thought I was doing something wrong and then I came across this video. Thank you Kevin!

  • @zachjensz
    @zachjensz 2 роки тому +46

    Meanwhile CSS frameworks be like:
    Let's build our entire grid system with flexbox

    • @riddixdan5572
      @riddixdan5572 2 роки тому +3

      that's the reason why I use frameworks only for components and not for layouts.

    • @Dead_Goat
      @Dead_Goat 11 місяців тому

      thats because they know grids are cancer and you should never use grids.

  • @ubtonai.online7988
    @ubtonai.online7988 2 роки тому

    i am never see your tutorials. But now i see, you amazing teacher. Thank for the awesome tutorials

  • @wpeasy
    @wpeasy 2 роки тому +1

    You have a gift :) I wish I could explain things as clearly as you do. I tend to over-explain. You are always concise and on point.

  • @KimKim-no1lu
    @KimKim-no1lu 2 роки тому

    Thank you, always! Another great content and I love your new haircut! 😊❤

  • @mparth35
    @mparth35 2 роки тому +40

    As someone who learnt flexbox first and found it way easier than grid, I use flexbox for everything (or don't know how to use grid). For this situation, I just throw max-width for each column and everything works fine.

    • @KevinPowell
      @KevinPowell  2 роки тому +12

      That can help, but it won't fix the issue here unless you put in a fixed size, like say "30%" in this case, but I wouldn't want to do that here because I can use this for 1, 2, 3, 5, 10(!) columns with a single class.

    • @chotai
      @chotai 2 роки тому +9

      @@KevinPowell that's why I wanna learn the grid. I just want grid to be as handy as flex is for me. xD
      BTW everything I know about the CSS, mostly is because of your channel!!

    • @mparth35
      @mparth35 2 роки тому +4

      @@KevinPowell exactly that's the only problem but the kind of work that I do. It's mostly creating landing pages and the final design always remains the same. So an exact value for max-width works out well.
      But as @sharanam chotai mentioned, I want to learn grid for the same reason as well. But coming out of my shell is not as easy as I thought🥲

    • @AntiAtheismIsUnstoppable
      @AntiAtheismIsUnstoppable 2 роки тому +4

      @@mparth35 If you create landing pages in your job, then spend a little of your spare time on something completely different, for example, a blog post design. Never stay stagnant and static, especially when you're younger you need to develop your skills constantly.

    • @Frostbytedigital
      @Frostbytedigital 2 роки тому

      ​@@AntiAtheismIsUnstoppable agreed. I'm not even remotely experienced in web development, react and others are still foreign to me. Bit understanding flex vs grid and using them separately, along with understanding position types are some of the most important.

  • @BurritoBrooks
    @BurritoBrooks 2 роки тому +7

    As someone just getting into this I find grid and subgrid to make more sense to me for a lot of layouts. Though I hear using both is the best way.

    • @KevinPowell
      @KevinPowell  2 роки тому +5

      Yeah, flexbox 100% has it's uses! But I use grid for a lot of stuff these days

    • @BurritoBrooks
      @BurritoBrooks 2 роки тому

      @@KevinPowell Nice! I’m on the right track then.

  • @UnnDunn
    @UnnDunn 2 роки тому

    My mantra is “Grid for laying out containers, flex for laying out content.”

  • @GameFuMaster
    @GameFuMaster Рік тому

    0:32 why I stopped using flex and am just going to use absolute and calculate things myself (even if it's going to be marginally slower).
    I added a large image, which I wanted to basically just take up the remaining space, and it ended up pushing the cell wider than its set size...

  • @timm.7740
    @timm.7740 2 роки тому

    thanks for all your great content!

  • @CottidaeSEA
    @CottidaeSEA 10 місяців тому +1

    If all children should have the same size, grid is usually the best option.

  • @ynotpeanutbutter
    @ynotpeanutbutter 2 роки тому +1

    I'm not a professional coder or anything. Just doing it for fun, but also for a long time. And coming from doing layouts with table, everything else is pure magic 😅
    Also, great content thank you so much! You have a very great style of teaching.

  • @kaveengoonawardane9651
    @kaveengoonawardane9651 2 роки тому

    Great video Kevin. Thanks!

  • @nataliakaraseva8630
    @nataliakaraseva8630 2 роки тому

    Thank you very much! Very clear and interesting to watch!

  • @JayCeeGee
    @JayCeeGee 2 роки тому +2

    I avoid media queries for the most part by utilizing flex-basis for the children. This tends to handle most responsive scenarios, but you can still run into issues with width when using flex-grow if your goal was for all of the children to stay the same width. In those instances (where I want a true grid/table) I use grid layout and a custom reusable set of classes that access common width and gap variables. IE "gridRow--small", "gridRow--largest gap--large", "gridRow--medium gap--smallest". Its an easy way of saying "I have a list of things that look best around (X) size... just display them and let them wrap if they need to". I can also nest them, tell them to fill available real estate, dont fill available real estate, etc etc. It seems to work for 98% of all my needs for a few years now.

    • @androidetube
      @androidetube 2 роки тому

      hi could you post some actual css code on what you are saying, It seems very interesting but I can't get it by reading your comment, thanks

  • @theGamerZed
    @theGamerZed 2 роки тому +1

    Another epic CSS video 🔥👍💙

  • @tedreams
    @tedreams 2 роки тому +6

    As a beginner, I want to say thanks for your great content. I always used flex ox over the grid and it's time to be comfortable with both 😊

  • @sbtopzzzlg7098
    @sbtopzzzlg7098 Рік тому

    Very informative and helpful, thanks Kevin! :)

  • @typeguard
    @typeguard 10 місяців тому

    Nice. I barely use grid and just flexbox everybody and their mother. However, it seems there's definitely benefits to using grid in certain situations. Thanks.

  • @HadrienMatringe
    @HadrienMatringe 2 роки тому

    Great video, thanks!

  • @CodeOpacity
    @CodeOpacity 2 роки тому

    Very useful. Thanks for the info

  • @juanmonster6232
    @juanmonster6232 2 роки тому

    I used this for a project today......Thank you very much

  • @MrKOHKyPEHT
    @MrKOHKyPEHT 2 роки тому

    First think: "What is support of grid?", but after small investigation on "caniuse" I realize that in this case grid is OP. Thx for trick and good practice)

  • @amjedh7133
    @amjedh7133 2 роки тому

    am learning a lot form ur videos thanks for the effort

  • @NNNedlog
    @NNNedlog 2 роки тому

    Awesome video as always sir

  • @motiondesign2501
    @motiondesign2501 2 роки тому

    Yes, when i used display flex it easy to me to centrer, justify, algin, but now i am using bootstrap it very ez and pushed u to be real pro and simple.

  • @montebont
    @montebont 10 місяців тому

    IMHO the concept of grid works better for me. You see what's defined in grid-columns. But that's just me and my apps that have a strict fixed column based layout and will ONLY work on a large screen by design. In a more abstract way: grid is more declarative / imperative than flex. I do admit I'm a control freak ;-)

  • @seanstanley252
    @seanstanley252 2 роки тому

    Thank you for your videos. I always enjoy them and have learned a lot.
    I've seen you do this before. Why didn't you suggest something like this for responsive grids? It works really well.
    .responsivegrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    grid-gap: 1rem
    }
    the grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); makes the grid responsive and wrap. auto-fit also works, but it expands the last row to fill the width which I never liked. It's a much better solution than flex for this situation.

  • @DragonRoyZ
    @DragonRoyZ 2 роки тому

    Cool stuff. Thanks!

  • @maxivy
    @maxivy 2 роки тому

    I've always hated CSS. Your channel helps a lot. Thank you.

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 2 роки тому

      As someone who was doing HTML back in the days before CSS, I must say I don’t miss all that old random collection of attributes one bit.

  • @davebudah
    @davebudah 2 роки тому

    Thank you for these great tips.

  • @aram5642
    @aram5642 2 роки тому

    Have you maybe considered migrating your intro logo bumper (0:35) to a dark theme? When I watch your videos (usu. before sleep) this flash of white background hurts my eyes :) ty!

  • @TomasMisura
    @TomasMisura 2 роки тому

    it's obvious that combination of flexbox and grid is very powerful

  • @windmaomao
    @windmaomao 2 роки тому

    Good work Kevin. This probably is a design "flaw" by `flex`, maybe they didn't think of enforcing the size at the first place. It could be a feature as well. Anyway, practically I felt `grid` is useful for un-structured content and `flex` is more for the structured one, relatively speaking.

  • @FazilAhamedK
    @FazilAhamedK 2 роки тому

    A timely drop indeed. I am currently designing a cards design for a website.

  • @aleksandr95
    @aleksandr95 2 роки тому

    Thx, Kevin!

  • @paulking8124
    @paulking8124 5 місяців тому

    I literally hate CSS, so im glad I found you

  • @sircarloschaves
    @sircarloschaves Рік тому

    I love you Kevin

  • @alexbaa9998
    @alexbaa9998 2 роки тому

    display: flex
    justify-content: space-evenly

  • @brteller
    @brteller 2 роки тому

    Look into TaikwindCSS. It's really intuitive for grid and flex box layouts. You honestly need to use both appropriately together or neither work as well as they should. TaikwindCSS bridges that gap unlike any other css tool I've ever used.

  • @oscarmcclenton6279
    @oscarmcclenton6279 2 роки тому

    Hey Kevin, thanks for all of the videos you continue to put out. They've been a huge help on my front-end journey!
    Two questions for ya (or anyone else that may know) if you don't mind!
    1. Which video/short was it where you discussed giving a background image full bleed inside of a div/element?
    2. What method would be best to contact you with inquiries about front-end/css in general? (Kind of a question that potentially leads to more questions here haha 🤔😅)
    Thank you so much man! Youre an inspiration and a great teacher, already looking forward to your next videos!!
    🧑🏼‍💻🤝🏻

    • @KevinPowell
      @KevinPowell  2 роки тому

      For #1 - ua-cam.com/video/MywezIxlp8Y/v-deo.html
      For #2 - my discord is best (link in video's description), though it's more of a good place to ask questions, not really ask me directly (though I am pretty active in there).

  • @markpatrickwhite
    @markpatrickwhite 2 роки тому

    Opinions on the "grid for layout, flex for components" guideline?

  • @LoveCaseOh
    @LoveCaseOh 2 роки тому +1

    I’m using width:33.3%; and float:left;

  • @Z3ROR
    @Z3ROR 2 роки тому

    This video got me thinking..... Kevin, I was wondering if you can make a video to explain WHEN it's better to use Flexbox and WHEN it's better to use Grid.

  • @eurosat7
    @eurosat7 2 роки тому +1

    I wonder if box-sizing does affect flex.

  • @chriswagoner3316
    @chriswagoner3316 2 роки тому

    Thank you.

  • @giorgiobellisario
    @giorgiobellisario 2 роки тому +6

    The good and bad of CSS is all that. It surprises you every project, also on re-design, and you'll never stop learning new tricks to get around situations. 🤯

  • @aryasutrisna6961
    @aryasutrisna6961 2 роки тому

    widh: calc(100% - 60px) & space between 😁

  • @centrumsaiyan7623
    @centrumsaiyan7623 2 роки тому

    At least I can spend time mastering grid without worries now.

  • @freeeeplay
    @freeeeplay 2 роки тому

    What about just... setting a fixed width on the columns?
    flex-grow: 1;
    width: 300px; (where it'll wrap)

  • @MiguelFelipeCalo
    @MiguelFelipeCalo 2 роки тому

    I find flex better at semantics, readability, and utility.
    Ex. bootstrap's
    container -> row -> col

  • @kapa4208
    @kapa4208 2 роки тому +8

    Most of the time I use grid, but sometimes, when I want the last row of the items to be horizontally centered when the total items of the last row is less than the number of grid columns, I don't think grid can do that since it's a 2 dimentional layout, but flexbox can do.

    • @KevinPowell
      @KevinPowell  2 роки тому +4

      Yup, good use case for flex there :)

    • @blejac948
      @blejac948 2 роки тому

      Wait how do you do that?
      You mean like for example having 3 divs, you place 2 divs in a 1 row and last one you center in the middle of the second row to look better?
      How would you do it with flex?

    • @kapa4208
      @kapa4208 2 роки тому

      @@blejac948 There is no trick, it's the default behavior of flexbox. Just add these props to the parent: "display: flex; align-items: center; justify-content: center; column-gap: 1rem; row-gap: 1rem".

    • @blejac948
      @blejac948 2 роки тому

      @@kapa4208 Yeah I think we are not understanding each other. If you set it up like that you are just going to have 3 divs in 1 row. What I was talking about, and got from your first comment is 2 divs in 1 row, 1 div in a second row, horizontally centered.

    • @kapa4208
      @kapa4208 2 роки тому

      @@blejac948 If all items fit in 1 row, why bother to separate them into a new row. What I meant, if you have 7 cards, and for example in desktop viewport it can contain 5 cards (higher than that then the cards will be shrinked too much), then flexbox will put the remaining cards into a new row (btw i forgot that you also have to specify this prop to the parent element "flex-wrap: wrap"). And then it's just the matter of how you specify the width of the children (those 7 cards), whether you are using flex-basis property, or width property, either using percentage value or fixed value.

  • @dugannash9109
    @dugannash9109 2 роки тому +6

    very timely video. I was working on a frontend mentor challenge and I ran into this exact issue with columns being misaligned. I've been using flex almost exclusively since I've started and I'm gonna have to get more familiar with grid.
    I found a good little gamified learning site for grid that covers the basics. It's called "Grid Garden" if anyone's interested.

    • @Bansh33
      @Bansh33 2 роки тому +1

      when i was learning CSS my teacher gave us the links to grid garden and flexbox froggy and every single one of us thought how amazing and how easy it was to learn with this games

    • @dugannash9109
      @dugannash9109 2 роки тому +1

      @@Bansh33 It's awesome how many people put in the effort in order to teach others! The visual nature of the gamified stuff really helps (as opposed to just reading docs).
      The flexbox game I started with was called flexbox zombies (lol), another good one.

    • @Bansh33
      @Bansh33 2 роки тому

      @@dugannash9109 I agree!
      have to check that one, thank you

  • @pahtashow
    @pahtashow 2 роки тому

    Is flexbox is better for SEO and speed or grid is better for SEO and page load ?

  • @ejazmuneeb
    @ejazmuneeb 2 роки тому

    awesome very helpful.

  • @Andres_cali
    @Andres_cali 2 роки тому

    I see you from a mountain in colombia, i give thanks to Gosh for the connection that allows me to see you. I have a question.... How font size responsive, % em rem which one use? Should i use tag or use the images as background with css?... I wanna build something but not just copy the work others but understand what i a doing!! Thanks i dont know if i wrote in good way. But thanks for your attention. Peace

  • @alimodz6253
    @alimodz6253 2 роки тому

    also to add grid gap works on older browsers than flex

  • @Nightrapture
    @Nightrapture 2 роки тому +1

    Honestly, as I discovered grid I've totally abandoned flex for every layout, even in single row. Grid is pretty straight forward and simple, expecially for column dimensions and positioning. The only thing I find useful about flex is to center a single element vertically and horizontally, for everything else grid is the best.

  • @markrobershorts
    @markrobershorts 2 роки тому

    The haircut 👌

  • @dagoeneko
    @dagoeneko 2 роки тому

    grid: auto / auto-flow 1fr; is definitely one of my most used css rules.

  • @kagari21
    @kagari21 2 роки тому

    can grid create layout like this on list article?
    --- --- ---
    --- ---

  • @arunsaklani9890
    @arunsaklani9890 Рік тому

    Sir to avoid height for background image how to give height without using height using flexbox or grid plz reply😊

  • @TommieHansen
    @TommieHansen 2 роки тому

    Why insert a media-query instead of actually using grid minmax? That way the columns will Start to collapse without having to resort to statically set mediaqueries.

  • @mrflocky6711
    @mrflocky6711 5 місяців тому

    hey uh, whats that font you are using??

  • @PeterSedesse
    @PeterSedesse 2 роки тому +1

    None of this make sense to me. There are clearly times when grid is better than flexbox, but are there any instances where flex is clearly better than grid? I think flexbox only exists because of inertia of people who started before grid was a thing.

  • @pesicon8674
    @pesicon8674 2 роки тому

    Why u don't use
    display: grid;
    grid-template-colums: repeat(auto-fit,minmax(min(100%,200),1fr)) ?

  • @MrJettann
    @MrJettann 2 роки тому +1

    Kevin, nice video as always! But I want to ask you, is there any way to center items in grid which moves to next row? For example I have 4 items of the same size, and then there are not enough space for all of them, one will move to the next line and centering? If I do repeat auto fill etc it works by columns, but I want next line to be whole width and centering items:) hope you understand me, have a nice day!

    • @KevinPowell
      @KevinPowell  2 роки тому +3

      No, not how grid works. For that you do need flexbox, and it would just mean you would have the parent flex container, then inside that your columns, and then *inside* the columns you can place the content, and you'll avoid this issue

  • @simon.tomtom.design
    @simon.tomtom.design 2 роки тому +1

    Flexbox is the better solution for me when I do a 5 columns layout (for showing features or values, imagine an icon centered on top of each children) and want it to wrap but be centered. So context can also dictate the best approach sometimes. But thanks for another great content!

  • @BK-qx3qf
    @BK-qx3qf 2 роки тому

    You should just add "cta" class in first div wrapper UNDER column div. Column div should never be messed with. :) Friendly advice-

    • @KevinPowell
      @KevinPowell  2 роки тому

      That would solve the issue, and works fine, but when I don't have to bother with "columns" and then content inside the columns, and just plug content into the grid, I find it so much easier and cleaner.

  • @WyzrdCat
    @WyzrdCat Рік тому

    I prefer to just set a width on the flex items, personally. Really never cared for grid. Probably because I started trying to use it back when IE still mattered and went absolutely insane trying to make it work over there.
    Now I only use Grid to hack stuff into overlapping other stuff while still having flow lol.

  • @hrabianero
    @hrabianero 2 роки тому

    i like grid, but i have two problems with it: 1. how center elements easily like in flexbox, 2. why in firefox fr unit is sometimes weird

    • @davien001
      @davien001 2 роки тому

      Place-items: center;

    • @hrabianero
      @hrabianero 2 роки тому

      @@davien001 nope i meant center columns - for example in 3 column grid i want last row to center if there's less than 3 columns used - you can't do that in grid - if this will be possible flexbox will be out.

    • @davien001
      @davien001 2 роки тому

      @@hrabianero align-self: center;
      justify-self: center; On Child element;

  • @davidvoskanyan5783
    @davidvoskanyan5783 2 роки тому +1

    It's a very interesting video (as always), but I have a question(as always). Why can't we just give "box-sizing: border-box" to the all child-elements?

    • @KevinPowell
      @KevinPowell  2 роки тому +2

      Because flexbox isn't looking at the box-size, it's looking at the content size. I had that rule in my CSS and should have shown it in the video to show that it doesn't have any effect.

    • @chotai
      @chotai 2 роки тому

      @@KevinPowell so are you going to put that update in upcoming video or anything else ..?

    • @davidvoskanyan5783
      @davidvoskanyan5783 2 роки тому

      @@KevinPowell yeah, after asking, I had a free minute to check it on my own, but anyway thank you (both for answer and for content you create)

  • @weblearningd2294
    @weblearningd2294 2 роки тому

    I prefer grid but i think there is Cross browser problem with it. Do you have any solution for that issue?

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 2 роки тому

      I look at the browser-support matrix on MDN for the “display: grid” option, and I don’t see any obvious red marks. Which ones cause trouble?

  • @markons9391
    @markons9391 2 роки тому +2

    This is okay in theory😊some IOS devices doesn’t support grid,aldo the documentation says differently. For now I think that flex is still better

    • @18.j
      @18.j 2 роки тому

      My man internet explorer support grid tf you are talking about iphone 3g browser?

    • @markons9391
      @markons9391 2 роки тому +1

      @@18.j I'm just saying facts. I'm working as a developer and I need to check on many devices

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 2 роки тому

      Apple’s browser is crap. Is it really worth the headaches to pander to them?

    • @lawrencedoliveiro9104
      @lawrencedoliveiro9104 2 роки тому

      @Ghots But the USA only accounts for something like 20% of the world market.

  • @forbiddenera
    @forbiddenera 2 роки тому

    always swapping flex and grid..quite often find I can use the other instead.
    and as for unreasonable padding IRL ugh 😑 I swear this current design has like 20em padding on everything

  • @usmanshahid8529
    @usmanshahid8529 2 роки тому +2

    People use flexbox over grid because most browsers support it ☺️

  • @maksz42
    @maksz42 2 роки тому

    How to make equal width columns if one of the children has a border?

    • @KevinPowell
      @KevinPowell  2 роки тому +1

      Grid will work there too :D

    • @maksz42
      @maksz42 2 роки тому

      @@KevinPowell Ok, columns are equal indeed, but what about equal rows? Unlike the width, the height doesn't want to shrink and the whole next row is pushed down.

  • @MrJgracias
    @MrJgracias Рік тому

    Why not just use relative position and absolute position?

  • @judojudani8003
    @judojudani8003 Місяць тому

    You can just give them a flex basis of 0 so space is distributed equally

  • @schwetang
    @schwetang 5 місяців тому

    I ran into issues with flexbox on mobile but that never happens with grid. Imma grid lover now.

  • @lebster_
    @lebster_ 2 роки тому

    Would box-sizing: border-box; not fix this?

    • @KevinPowell
      @KevinPowell  2 роки тому

      Nope. I should have mentioned it in the video, but I had that already. Flexbox, isn't looking at the box-size, but only the content-size no matter what you do.

  • @proteus1
    @proteus1 2 роки тому

    Divs arn't semantic, so why use them? Are Container Q mainstream now?

    • @KevinPowell
      @KevinPowell  2 роки тому +1

      Not every element needs to be a semantic one, and in this example I don't really know what would be more appropriate 🤔. It's possible that a .card type thing could be an article, but it's pretty dependent of the content and showing that as a "default" could lead to more problems than improvements.

  • @JonathanPyper
    @JonathanPyper 2 роки тому

    Are you using Firefox Kevin?

  • @QwDragon
    @QwDragon 2 роки тому

    Seems like you already talked about it in some other video?

    • @KevinPowell
      @KevinPowell  2 роки тому +1

      Sure have, but I think it's the first time I focus specifically on this :)

    • @chotai
      @chotai 2 роки тому

      @@KevinPowell oh, I must need to watch your videos again... Probably, I missed that part somehow

  • @markus_code
    @markus_code Рік тому

    Grid is not solution at all because is not supported RTL. I still don't understand why they did't inclement it. Basically you need add more code inside css to support RTL in grid. But flex instead support it by default. I understand that in some cases its not necessary. For example gallery there is now way to do grid of images like metro style without grid. But still its only one place where I see it to use grid.

  • @LuBre
    @LuBre 2 роки тому

    Grid is awesome indeed. I've been using it since 2018 and never looked back. I use flexbox once or twice a year at most, when I need to display a random list of wrapping elements with random column sizes.

  • @ahmadmuraish1144
    @ahmadmuraish1144 2 роки тому

    Kevin we need a better explination to why this is actually happening ...
    I am occasionally running into this issue when I have a navbar of three 1frs

  • @drone_33
    @drone_33 2 роки тому

    justify-content: between?

  • @alexkiiru1283
    @alexkiiru1283 11 місяців тому

    nice mohawk 😅😁