How To Create a Responsive Image Grid (Masonry Layout) with HTML and CSS - Flexbox

Поделиться
HTML-код
  • Опубликовано: 29 сен 2024
  • In this tutorial, you'll learn how to to create a responsive image grid with CSS.
    Image list:
    source.unsplas...
    source.unsplas...
    source.unsplas...
    source.unsplas...
    source.unsplas...
    source.unsplas...
    source.unsplas...
    source.unsplas...
    source.unsplas...
    Sponsor me on GitHub!
    github.com/spo...
    Follow my blog:
    / miguelznunez
    Email : mignunez@csumb.edu
    Medium : / miguelznunez
    Codepen : codepen.io/mig...
    GitHub : github.com/mig...

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

  • @not_zara
    @not_zara Год назад +17

    dude you have no idea how much you saved me lol. i'm a high schooler who does a web dev internship who's been procrastinating all week, and i started my work almost an hour before my meeting. I was able to use this video to help me out and now i have 20 minutes to spare.

  • @Andy-lr6mz
    @Andy-lr6mz 10 месяцев назад

    thank you!

  • @TanvirAhmed-ur3kr
    @TanvirAhmed-ur3kr Месяц назад +1

    Thank you for the video. But in practical, we usually don't want images to flow from top to bottom. Rather, images or grids should flow from left to right. So, even if we need JavaScript to do that, we should go with that. No client will tell me that I should use only CSS to do his website. However, while leaning CSS, these techniques will definitely help.

  • @mohammadurgur953
    @mohammadurgur953 Год назад +4

    I asked my self exactly the same, so few viewers ?
    You deserve more.
    For me this was what I needed.
    But for total beginners they will manage to copy and make it work.
    I think it could be s god thing to quickly explain how you build everything in boxes inside boxes (containers)
    Then tell about the flex column and rows on the box above.
    It took me quite some time before i realised that.
    Just for future tutorials.
    But anyway, this was perfect for me.
    Quick and not dirty 🤪
    And in a very calm way.
    Thank you and keep going.

  • @Mr.K123
    @Mr.K123 Год назад +2

    Just wondering why this video has so little views specially likes and comments though its content is way much perfect...

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

    this will not work if all the images having the same size

  • @snowandcoal
    @snowandcoal 10 месяцев назад +2

    It starts at 4:30

  • @wisdomudo8269
    @wisdomudo8269 5 месяцев назад +1

    Thanks for this, fastest way to learn about flex box.

  • @nellepicard498
    @nellepicard498 4 месяца назад

    hello, I tried to make this ( five column of nine photos) but it does not work... i am a bit stuck and if anyone as an idea of what cause this i would really appreciate some help !

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

    this but automate the creation of a perfect masonry layout with just the pictures XD :)

  • @Nsbsha
    @Nsbsha 4 месяца назад

    i followe every step but it doesn t let me to put it on 3 colums when i set display flex for the photo-gallery div. why?:(

  • @GROOVETECHSETS
    @GROOVETECHSETS 8 месяцев назад +1

    Where is the code? Why no repo?

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

    How would you add this to a premade html/website with no css. Like the page has its own html.

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

    Brilliant, thank you, this works perfectly. I've been looking for a tutorial on madonry grids that works for AGES!
    Any suggestions on how I would go about having the column count go from 3 to 2 then to 1? I tried adding this in the CSS, but it didn't work:
    /* XX-Large devices (desktops, 1400px and below) */
    @media screen and (min-width: 1400px) {
    .photo-gallery {
    flex-direction: column;
    column-count: 2;
    }
    }
    /* Medium devices (tablets, 768px and below) */
    @media screen and (max-width: 768px) {
    .photo-gallery {
    flex-direction: column;
    }
    }

  • @shivaskanthan6144
    @shivaskanthan6144 Год назад +1

    Nice video, but how does this work with an array of images. Will I need to write a code to split them into three columns or is there a better way.

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

      Is the array of images coming from a server?

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

      Yeap. It come ms as an array of URL’s

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

    Underrated video. Tysm

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

    You should get a lot mor attention and viewers, this was very god. Thank you. thumbs up, comment, and subscribed.

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

    Nice and organized. Thanks buddy

  • @charlo-d2
    @charlo-d2 4 месяца назад

    What size are the images?

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

    Tanks a lot, how can I link the images to anoter url page?

  • @LifeONEarth-hf7dp
    @LifeONEarth-hf7dp 7 месяцев назад

    your voice is too sweet. thanks bro. grate work

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

    thanks you so muchhhhhh, finally i did it T^T

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

    thank you so much!

  • @rishabhrajpal9790
    @rishabhrajpal9790 6 месяцев назад

    THAAANK YOOUU BROTHER

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

    thank you so much! this is exactly what I was looking for

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

    thanks man! this was super useful for me!!

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

    Not efficient method though

  • @danisom9520
    @danisom9520 Год назад +3

    I followed this to the letter 3 times.....this code does not display as yours???????????????????????????????????????????????????????????????????????????????????? did you leave out a piece so people would pay your for the missing code if so stop making tutorials for money

    • @codefoxx
      @codefoxx  Год назад +2

      Sorry to hear, do you have a GitHub? I can look at your code

    • @AM-cs8yi
      @AM-cs8yi Год назад +4

      Common Dan, the amount of free help this guy provides on his channel I seriously doubt he would do that

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

      lol same here. i thought I was doing something incorrectly. But i'll try again anyway

    • @HamzaAli-rn1cc
      @HamzaAli-rn1cc 3 месяца назад

      @@codefoxx Bro u only give flex and flex direction column in this video nothing about grid and your code respond like grid
      my main question is think u forget to add grid in ths video LOL

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

    Great job! Need to do something similar at work this sprint.