Get started with grid WITHOUT being overwhelmed

Поделиться
HTML-код
  • Опубликовано: 25 июл 2024
  • It can be easy to be overwhelmed by CSS grid, so in this video I look at the very basics to get you started without worrying about too much at once.
    🔗 Links
    ✅ The next step with Grid: • Learn CSS Grid the eas...
    ✅ Grid inspector: • The grid inspector: ma...
    ⌚ Timestamps
    00:00 - Introduction
    01:02 - the relationship between the parent and children
    03:51 - grid-template-column basics
    04:35 - the fr unit
    06:20 - comparison to flexbox
    07:19 - the repeat() function
    07:37 - responsiveness
    #css
    --
    Come hang out with other dev's in my Discord Community
    💬 / discord
    Keep up to date with everything I'm up to
    ✉ www.kevinpowell.co/newsletter
    Come hang out with me live every Monday on Twitch!
    📺 / kevinpowellcss
    ---
    Help support my channel
    👨‍🎓 Get a course: www.kevinpowell.co/courses
    👕 Buy a shirt: teespring.com/stores/making-t...
    💖 Support me on Patreon: / kevinpowell
    ---
    My editor: VS Code - code.visualstudio.com/
    ---
    I'm on some other places on the internet too!
    If you'd like a behind the scenes and previews of what's coming up on my RUclips channel, make sure to follow me on Instagram and Twitter.
    Twitter: / kevinjpowell
    Codepen: codepen.io/kevinpowell/
    Github: github.com/kevin-powell
    ---
    And whatever you do, don't forget to keep on making your corner of the internet just a little bit more awesome!

Комментарии • 119

  • @apporvaarya
    @apporvaarya 10 месяцев назад +4

    ur channel is my go-to resource to refresh and add to my CSS understanding... thanks Kevin

  • @alwinter
    @alwinter 2 года назад +7

    Thanks for boiling down CSS grid. I sometimes tend to overthink when using it. I'll be keeping this video in mind moving forward!

  • @fullmoon8524
    @fullmoon8524 2 года назад +31

    I've recently found you and I'm so glad because I can understand html/css much better due to your excellent explanation. You are a real gem. 🙂🙏🏻 Thank YOU so much!

    • @engjellbakiasi742
      @engjellbakiasi742 Год назад

      are you nuts? this is the worst video about grid in the entire world!!

  • @RemainderMan
    @RemainderMan 2 года назад

    Hey Kevin!
    I just wanted to say thank you, CSS always kinda intimidated me but you've made it so easy to comprehend for me, immensely thankful

  • @omotehinseelvis9845
    @omotehinseelvis9845 2 года назад

    You've literally fast tracked my CSS learning journey since I found your contents, thank you.

  • @_loss_
    @_loss_ Год назад

    I really needed this. All your videos are so great because of how good you are at explaining things.

  • @ncookiez
    @ncookiez 2 года назад +1

    I literally just had to design a grid, and being more familiar with flex I tried to use it. Had a lot of problems with that. This solves my problem perfectly, with 2 lines of code. You're magical!

  • @mikaelayumang2839
    @mikaelayumang2839 Месяц назад

    thank you sir! your explanation makes css grid easy to understand

  • @CraveThatCoin
    @CraveThatCoin 2 года назад +7

    Fantastic tutorial. I've been working with HTML/CSS for over 10 years now (even the old floats/clear). The one thing I have avoided to this point is grid. This gives me confidence to dive in.

  • @BABANSK
    @BABANSK 2 года назад +1

    you taught me many things about CSS. I was not good at designing part a few months ago but now I can say confidently that I know CSS. thnk you, Kevin. Love from India.🤍

  • @Allformyequine
    @Allformyequine 2 года назад +2

    So awesome as usual!! Just perfectly explained!

  • @jeisondiasf
    @jeisondiasf 2 года назад

    Your videos are amazing! I'm enjoying all of them. Thanks for sharing your knowledge with us.

  • @joyvideos1802
    @joyvideos1802 2 года назад

    You r digging something up in css everyday & bring us css golds. Thanks a lot Kevin

  • @daleryanaldover6545
    @daleryanaldover6545 Год назад

    Whenever I need reference videos for teaching interns, I always refer to you videos. All the things you teach here is always relevant!

  • @brujala1775
    @brujala1775 2 года назад +1

    I am so glad i watched this video, i love this channel!

  • @iamtharunraj
    @iamtharunraj 2 месяца назад

    Your explanations are so good to hear! ❤

  • @chadchampion893
    @chadchampion893 10 месяцев назад +1

    the goat of css

  • @developer_hadi
    @developer_hadi 2 года назад

    BEST GRID TUTORIAL ON RUclips , THANK YOU SO MUCH❤️

  • @omniosi
    @omniosi 2 года назад

    Excellently explained as always! Nothing else I read made this much sense.

  • @giulia6930
    @giulia6930 2 месяца назад

    Thanks, you taught me everything I needed, I'll follow your advice to learn grid in the best way🙏

  • @ethanjames
    @ethanjames 2 года назад

    Thank you so much Kevin, you helped me understand this even more than I did before kudos.

  • @jeralidea
    @jeralidea 2 года назад

    I think Kevin is the best I'm learning to write CSS with confidence...... thanks a lot Kevin!

  • @iamavegetable1936
    @iamavegetable1936 Год назад

    Excellent, clear, concise and good examples. Thanks a lot!

  • @tyronefrielinghaus3467
    @tyronefrielinghaus3467 2 года назад

    Super Kevin... you're an awesome explainer...and I like how you concentrate on the essentials. I'm new to grid...and this was super helpful to get me started. Thanks!👍
    Oh...and you don't dumb it down either...you actually give insight on what's really happening. My kind of learning!

  • @mathis-meth4229
    @mathis-meth4229 2 года назад

    thank you so much sir. it's so good to see videos from you. and I love your love for css. We all are waiting for you to start uploading Javascript videos also.

  • @omkarp9943
    @omkarp9943 Год назад

    This video is very helpful Mr. Powell.
    Thank You!

  • @jrealm5464
    @jrealm5464 Год назад

    i love you kevin, you've saved my css life too many times

  • @Agent12214
    @Agent12214 Год назад

    Seriously, thanks Kevin!

  • @reb569
    @reb569 2 года назад

    Thank you for this video. This is awesome! I have been doing a deep dive into grid over the last couple months and this is very helpful! At work we've been using bootstrap since 2016, and I understand that pretty well, but it has actually put me behind on keeping up with modern css, including flexbox and grid. I am hoping after during our next redesign that we ditch bootstrap. It's such a "heavy" framework.

  • @brdoc12
    @brdoc12 2 года назад +2

    I always use this:
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    Or you can use 'auto-fill' instead of 'auto-fit'.

  • @matthewwhite3744
    @matthewwhite3744 Год назад

    Loved this! Just what I needed for these frontendmentor challenges because I want to start using grid instead of flexbox

  • @FuzailShaikh
    @FuzailShaikh 2 года назад

    Thanks for making these videos mate ✌️

  • @alijahan
    @alijahan 2 года назад

    thanks Kevin , i was just trying to use grid and i was confused since i always use flex and this came out just in time

  • @cameronerasmus633
    @cameronerasmus633 Год назад

    Hi Kevin! Thank you for all of your time and effort put into these videos - I'm a backend coder primarily but recently I've taken on a project that is really challenging me on the frontend. I have a layout that I would love your opinion on materialising. It's a CRUD system that has a topper and a sidebar (left side), and all other cards are rendered in the whitespace created by the top and side bars. I need the bars to remain position while the components in the whitespace change (using Reactjs). I tried sticking to flexbox only, but each of the components are built individually and then composed together to build the page. I ended up creating wrapper upon wrapper upon wrapper... you get the idea. I then tried grid (with components themselves using flex), it makes incredibly logical sense to me - however, I am having problems with different resolutions. Widths of the devices used on the frontend range from around 1300px to 4096px (no mobile). At this point I'm sitting with grid containers upwards of 60 columns and I'm getting nowhere.... Look FANTASTIC on the 4k res, but a driven-over grilled cheese below 2000px. I would GREATLY appreciate any advice you have on this 🙏🏼
    Here's the concept: drive.google.com/file/d/17cmDBVCrFvtafVGUygOCQbIR6_6-IYUn/view?usp=sharing

  • @fadehelix
    @fadehelix 2 года назад

    Thank you soooo much for this guide!

  • @alexprofit4937
    @alexprofit4937 2 года назад

    Thank, you I'm looking for this guide.

  • @Izumiko1_1
    @Izumiko1_1 2 года назад

    thank you, this made it easier to understand

  • @chukwuemekaemmanuel2497
    @chukwuemekaemmanuel2497 2 года назад

    Honestly sir, you deserve an award. Thanks..

  • @irenanmatthew9432
    @irenanmatthew9432 2 года назад +1

    Thanks for this!!

  • @mbcx3621
    @mbcx3621 2 года назад

    No one's talking about it, but I do like the darker ambience and colours of the background you have in your room! (or where you're doing the recording.) 😊👍 (great video! Always learning with your videos)

  • @nathanmark4219
    @nathanmark4219 2 года назад +1

    thanks for making css easier to understand

  • @alvaroprietovideos
    @alvaroprietovideos 2 года назад

    Thank you for sharing 🙏

  • @AnastSid
    @AnastSid 2 года назад

    That was a cool Video as usual keep doing what you are doing

  • @danielallen8434
    @danielallen8434 2 года назад

    Thank you, it is so helpful.

  • @lajosn
    @lajosn 2 года назад

    At last, somebody have maked it clear. Thanks!

  • @ekek7
    @ekek7 11 месяцев назад

    So you are telling me that I don't have to bang my head against the wall trying to figure out CSS positioning and display flex? 🤯🤯
    Considering that every website nowadays uses some type of a grid, I am using this in every container I design moving forward.

  • @galainak4195
    @galainak4195 Год назад

    You are a very good teacher!

  • @rishabhranjan5162
    @rishabhranjan5162 Год назад

    You are amazing sir

  • @hammerofolympia3716
    @hammerofolympia3716 2 года назад

    Thanks this was well timed i was messing about with grid earlier and made the mistake of using %

  • @chezchezchezchez
    @chezchezchezchez 2 года назад

    How many grid videos you got now Kevin ?
    Lol
    Finally, the one that won’t overwhelm us. Where has this been all my life? 🤪

  • @ygaaaoo
    @ygaaaoo 2 года назад

    thanks man for the tutorial

  • @rohan1765
    @rohan1765 2 года назад +2

    Great brief introduction for someone who doesn't know grid 🙂

  • @thatboymoti
    @thatboymoti 2 года назад

    THANKS! JUST IN TIME

  • @dailynews7822
    @dailynews7822 3 месяца назад

    Nice done. Grid is good layout

  • @prakharmathur619
    @prakharmathur619 2 года назад

    loved the video, simple and straight to the point.
    Just one question, when is your new scss course gonna launch?
    Been waiting for it !!

  • @denizcuhadari4334
    @denizcuhadari4334 2 года назад

    Hey Kevin thank you for these great videos.
    I would love to see a video about css browser compatibility.
    How to write (and test) css that's supported by the majority of browsers.
    I've recently struggled a lot with the gap property not being supported on older Safari browsers.

  • @nabilalaa7466
    @nabilalaa7466 2 года назад

    css king, thanks a lot ❤

  • @sawyer303
    @sawyer303 2 года назад

    Grid template areas made my life so easy

  • @andreaskarz
    @andreaskarz 2 года назад

    Wow, how easy is that? Great, thank you.

  • @abdollahmemar9170
    @abdollahmemar9170 Год назад

    tnx for your video

  • @daveskye
    @daveskye 2 года назад

    Nice. I have found Grid 'overwhelming' to learn, so have so far stuck with flexbox on my designs. Maybe I should start!!

  • @Sure_Math_Center
    @Sure_Math_Center Год назад

    5star! So good!

  • @ysammo214
    @ysammo214 Год назад

    Thankyou

  • @arpitagarwal8330
    @arpitagarwal8330 2 года назад

    Hey Kevin i m in love with ur css videos and tutorials.i have learned css and learning advanced by ur RUclips and practising.where can i learn javascript and master it

  • @michalnowak2181
    @michalnowak2181 Год назад

    thx

  • @brandon_wallace
    @brandon_wallace 2 года назад

    Grid is pretty cool.

  • @DiFedericoStudios
    @DiFedericoStudios 7 месяцев назад

    Hi Kevin, I have been watching your videos for a while now and have learned so much especially when it comes to grid. I have a question about grid I am having trouble finding an answer to. Maybe you could help. If you have a grid container with 3 children that have grid area names to make a grid-area-template on the container. What happens if you introduce a new div to the grid container that doesn't have a place in the grid-area-template. For example an off screen navigation. should this live in the grid container or should it be placed outside container. I have tried it and it doesnt effect the grid being inside, but is that the best setup? Been looking for a definitive answer on this.

  • @flashbond
    @flashbond 2 года назад

    I am really envy of your skills. I always wondered that if is it possible to make a CSS-only masonary? It was inpossible 10 years ago when there were no CSS grids. Back then the time that I was building websites to make extra money. Now I wonder if is it possible today's CSS properties?
    EDIT: I found your video!

  • @UmanPC
    @UmanPC 2 года назад

    GREAT

  • @MuhammadAhmedAshraf
    @MuhammadAhmedAshraf 2 года назад +7

    Hello Kevin Can you make an animation like youtube when you have internet avaiable that shows the button retry and when you click on it the animation just looks so amazing when longpress the animation goes slowly from where we clicked and when fastclick it goes fast and stops at 90% and i have researched it the animation name is paper ripple but those weren't i was expecting i think it can easly been done on android studio because i have seen this type of animation from android developers but can you make it with css and we enjoy your videos so much

    • @KevinPowell
      @KevinPowell  2 года назад +5

      Ah, yeah, Google uses that in a lot of places. I'll look into it :)

    • @MuhammadAhmedAshraf
      @MuhammadAhmedAshraf 2 года назад +5

      @@KevinPowell another one the customized tool tip when hover on channel tip and it position it self automatically when there's not enough space to the top and bottom can you also do backend and frontend mix videos since your css knowledge is already so amazing. It's been three months since i have been coding and now i am stuck i don't know what to build what project can you give me tips

  • @izexi
    @izexi 2 года назад

    pls make a video with elements placing with grid as centering etc.
    im using flex with justify-content, align-items, flex-direction, but im stuck with it in grid
    i would be really appreciated

  • @ayushyt918
    @ayushyt918 2 года назад

    Hii Kevin can you explain how to make a vertical timeline made using grid please Kevin

  • @MarcMateos
    @MarcMateos 2 года назад

    Hi Kevin! I've been struggling with this for way so long now, and didn't find the solution. Is there a way to make a column defined in the grid "optional"? I would like to keep the grid layout all around my site, but there are some sections where I don't have a sidebar in it. Is there a way to define the grid as something like "if the sidebar is present, then put in here with this column fixed size, but if it isn't, simply expand the main cell in the grid to fill the container".
    I know this can be done quite easily with flexbox (with flex-grow:1 and, simply, not adding the sidebar to the DOM), but now I'm learning grid and I've been stuck trying to figure out how to do it.
    Any advise? Is it even possible? Or due to grid specification the layout needs to be as it is, consistently? Thanks a lot!

  • @Trazynn
    @Trazynn 2 года назад

    How do I build a hexagonal grid in css?

  • @fumblingwelli
    @fumblingwelli 2 года назад

    Omg i realised your power

  • @proteus1
    @proteus1 Год назад

    Do you have a min-max and auto-fit for a css grid layout?

  • @jonathonkiner7415
    @jonathonkiner7415 2 года назад

    Thanks Kevin!! Is there any specific reason/instance when grid should be used instead of flex?

    • @KevinPowell
      @KevinPowell  2 года назад +1

      I've talked about it before in some videos, but the tl;dr is grid is better for more structured layouts, flex is better when you want the children to have more control. So, grid for more of a "layout", flex for things like navigations, tags, and some other things like that.

  • @bunnyboy7008
    @bunnyboy7008 2 года назад

    Btw, an offtopic request. Firefox has temporarily disabled "Backdrop-filter" property in their browser on account of some bug. Is it possible to get a video (or maybe even a short) on how we can create a workaround for this? Afaik @supports doesn't work either because of some other bug in the browser & the only viable solution is to be some other workaround.
    One can enable backdrop by going in about:config but considering not many users will have it enabled by default, it'll break out site's design.
    Would you be willing to look-up on it?

  • @yanhuan1
    @yanhuan1 2 года назад

    Hello, Kevin.
    Can you make a Responsive Design with Grid course?

    • @KevinPowell
      @KevinPowell  2 года назад +1

      Got some idea in the works :D

    • @ZiaCodes
      @ZiaCodes 2 года назад

      @@KevinPowell kevin can I work with you in building some websites?

  • @mariomeza3514
    @mariomeza3514 Год назад

    So correct me if i'm wrong, but wouldn't it be better and easier if we replace using flex with using grid with all projects? Grid can do all the things that flex can do, except that it seems you have more control with grid and grid is more accurate.

  • @N7Null
    @N7Null 2 года назад

    How did you get the detailed inspect element info tooltip at 6:45? Mine only shows the element and size.

    • @KevinPowell
      @KevinPowell  2 года назад

      In Chrome? I haven't done anything special that I know of to get that.

    • @N7Null
      @N7Null 2 года назад

      @@KevinPowell Yeah, I didn't realize you were using Chrome until I tried figuring it out myself. Thanks for the response though.

  • @JoeBonez
    @JoeBonez 2 года назад

    Can you explain why, often when doing columns with say “repeat(10, 1fr)” I do NOT get even columns? I have to change it to repeat(10, minmax(0,1fr))” to get even columns. I find that this happens quite often when doing grid layouts using areas. Thanks!

    • @KevinPowell
      @KevinPowell  2 года назад

      I'd have to see the issue to comment, I can't say I've ever run into something like that 🤔

  • @somnathgolui2912
    @somnathgolui2912 2 года назад

    are you useing tailwind CSS??

  • @jfreeg
    @jfreeg 2 года назад

    How about box sizing ??
    To make sure it doesn’t overflow

    • @brownrhythms
      @brownrhythms 2 года назад

      I believe that's one of his defaults when making a full CSS file. I just don't see percentages used that much though unless as he pointed out you actively want it to be that size.

    • @jfreeg
      @jfreeg 2 года назад

      @@brownrhythms right

    • @KevinPowell
      @KevinPowell  2 года назад +1

      box-sizing won't really have a big impact if you're using grid, unless you're setting widths on the items inside the grid and allowing them to set the cell widths or heights (with a template-row or column set to something like min-content or max-content).

  • @user-ms8ei9le7x
    @user-ms8ei9le7x 2 года назад

    ®️

  • @CheerfulNE
    @CheerfulNE 2 года назад

    I have been using FLEX inside GRID, is that a wrong way to do so?

  • @nomadshiba
    @nomadshiba 2 года назад

    i never use @media queries. they are not reliable if you are designing components not pages
    and i dont like having different css for different screen sizes
    i just use flex and grid tricks to make reusable responsive layout components

    • @nomadshiba
      @nomadshiba 2 года назад

      for example lets say you have a form, and a button
      on wide screens you want button to not fill all of the space
      and you want it to fill all of the space when on mobile
      so you do something like this
      .fill-on-break {
      display: flex;
      flex-wrap: wrap;
      }
      .fill-on-break > * {
      flex-grow: 1;
      }
      .fill-on-break::after {
      content: "";
      min-width: min(100%, var(--min-empty-space));
      flex-grow: 1000000000000000;
      }
      and put the button in it
      you can also make this `justify-items: center`, and it would center the button on break inside of filling the whole space

    • @KevinPowell
      @KevinPowell  2 года назад

      Media queries aren't perfect, but they serve a purpose, and hacks like that (which work!) will just confuse someone who's just getting started, who this is intended for.
      I'm also really looking forward to container queries, so we won't need things like that in the future.

    • @CraveThatCoin
      @CraveThatCoin 2 года назад

      @@nomadshiba Not sure how you can say media quires are not reliable when your own code would be more likely to cause browser compatibility issues.
      Media quires are tried and tested but of course less is more.

  • @hagopderderian6824
    @hagopderderian6824 2 года назад

    Sorry i have question dont you have javascript videos? like for beginners and stuff

    • @KevinPowell
      @KevinPowell  2 года назад

      I touch on it now and then, but CSS is my main focus :)

  • @straightupanarg6226
    @straightupanarg6226 2 года назад

    All hail god-king Algorithm!

  • @hyperprotagonist
    @hyperprotagonist 2 года назад

    Kevin, without sounding abrupt but inevitably doing so, you need to work on repeating the phrase “I’m going to come here”. 🤫

  • @lenarnie2973
    @lenarnie2973 2 года назад

    Grid looks so nice on these Basic content. But its so useless to use in real web template building. U Can use Grid when u want image Grid or something, but build web layout with Grid is useless. And it have white space Bug , Flex have this Bug too

    • @KevinPowell
      @KevinPowell  2 года назад

      I use grid for real layouts all the time, more often than flexbox. If you get complex and layout things on specific lines and columns, I agree that it's not very practical for scalable solutions, but you don't need to use it that way. And what's the white space bug? Both flex and grid don't have collapsing margins on their children, but that isn't a bug, it's an intended behavior.

    • @lenarnie2973
      @lenarnie2973 2 года назад

      @@KevinPowell white space at bottom, where is 1-3px space after last item in Grid or Flex. And u cant use background color, bcs it looks so Bad with that space. If i Remember correctly, it happens when i use img inside the box, idk right now. I will work with it again and i send u example of it

    • @dimkayilrit2606
      @dimkayilrit2606 Год назад

      @@lenarnie2973 use
      100% width and height on the img.
      img{
      width:100%;
      Height:100%;
      }
      it will cover the remaining space

  • @oliverR155
    @oliverR155 2 года назад

    you didn't actually compare it to flex, you just changed display to flex...?

    • @KevinPowell
      @KevinPowell  2 года назад

      Fair enough... to get the same thing I would then have had to make a new selector that selects all the children, and declared either "flex: 1" or "width: 100%"

  • @TheLightedSky2112
    @TheLightedSky2112 2 года назад

    Love how all his 'GET STARTED' videos include: "OK, as you can see I've ALREADY LAID OUT STEPS THREE HUNDRED AND FORTY-SEVEN in this process so let's just continue with...". Never actually starts at the beginning of anything, ever. He also seems completely uninterested in defining basic characteristics of core element behavior. Too bad.

    • @KevinPowell
      @KevinPowell  2 года назад

      What steps did I skip? The only thing was having some HTML in place. I could have written that out, but I broke down the structure it needs to have, which is really all that's important here. The stuff in those divs could be anything at all.

    • @TheLightedSky2112
      @TheLightedSky2112 2 года назад

      @@KevinPowell Guess I just have to work harder at it and dive deeper into the labyrinth at it's structural root. Thanks for the feedback!