0

I want to create an image gallery in the CSS Grid Layout and I need to add a horizontal scrollbar for non-viewable images. I want the image block to be added not to the bottom but to the right.

.wrapper {
  display: grid;
  grid-template-rows: repeat(3, 33.34%);
  grid-template-columns: repeat(4, 25vw);
  grid-gap: 10px;
  height: 100vh;
}

.box1 {
  grid-column-start: 1;
  grid-column-end: 3;
}

.box2 {
  grid-column-start: 3;
  grid-column-end: 4;
  grid-row-start: 1;
  grid-row-end: 3;
}

.box8 {
  grid-column-start: 2;
  grid-column-end: 4;
}
<body>
<div class="wrapper">
    <div class="box1" style="background-image: url(https://placeimg.com/1000/500/animals); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box2" style="background-image: url(https://placeimg.com/1000/500/sepia); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box3" style="background-image: url(https://placeimg.com/1000/500/tech); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box4" style="background-image: url(https://placeimg.com/1000/500/any); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box5" style="background-image: url(https://placeimg.com/1000/500/people); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box6" style="background-image: url(https://placeimg.com/1000/500/nature); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box7" style="background-image: url(https://placeimg.com/1000/550/any); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box8" style="background-image: url(https://placeimg.com/1000/500/architecture); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box9" style="background-image: url(https://placeimg.com/1000/500/any); background-repeat: no-repeat; background-size: cover;"> </div>
    <div class="box10" style="background-image: url(https://placeimg.com/1000/500/grayscale); background-repeat: no-repeat; background-size: cover;"> </div>
</div>

1 Answers1

-2

Hi try to look at this:

https://codepen.io/andybarefoot/pen/ypXYVJ

    #grid {
  writing-mode: vertical-lr;
  display: grid;
  grid-gap: 2vh; 
  grid-auto-rows: 1.52vh;
  grid-template-columns: repeat(5, 17.6vh);
  grid-auto-flow: row;
  text-align: center;
}

it may help you rewrite your grid :-)

Roman Vala
  • 1
  • 1
  • 1