Adding additional images to the left side of the slide

My goal is to display multiple images in two rows. The alignment works well for up to 9 images, but beyond that, the additional images appear on a third row instead of staying within the two rows. I want to ensure they are contained within 2 rows only. How can I achieve this? D: I am aiming for a gallery layout similar to websites like zillow.com and hotels.com where users can upload their images. It's possible that not all uploads will have as many images, but I don't want to set a maximum limit.

.grid-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 165px;
  grid-gap: 10px;
}

.grid-container>div {
  text-align: center;
  font-size: 30px;
}

.item1 {
  grid-row: 1 / 3;
}

.detailed-gallery-outer {
  overflow: hidden;
  width: 100%;
}

.detailed-gallery-inner {
  float: left;
  position: relative;
}

.detailed-gallery-tmb {
  float: left;
  margin: 0 10px 0 0;
}

.detailed-gallery {
  display: flex;
  justify-content: space-between;
  padding: 0;
  position: relative;
  width: 1140px;
  margin: 0 auto;
}
<div class="detailed-gallery">
  <div class="arrow-left">
    <div class="arrow-left-small">
    </div>
  </div>
  <div class="container">
    <div class="detailed-gallery-outer">
      <div class="detailed-gallery-inner">
        <div class="grid-container">
          <div class="item1"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office1" width="250" height="340" /></div>
          <div class="item2"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office2" width="250" height="165" /></div>
          <div class="item3"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office3" width="250" height="165" /></div>
          <div class="item4"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office4" width="250" height="165" /></div>
          <div class="item5"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office5" width="250" height="165" /></div>
          <div class="item6"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office6" width="250" height="165" /></div>
          <div class="item7"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office7" width="250" height="165" /></div>
          <div class="item8"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office8" width="250" height="165" /></div>
          <div class="item9"><img src="https://www.w3schools.com/howto/img_forest.jpg" alt="office9" width="250" height="165" /></div>
        </div>
      </div>
    </div>
  </div>
  <div class="arrow-right">
    <div class="arrow-right-small">
    </div>
  </div>
</div>

I could share the JavaScript code too, but I don't believe that is the issue.

Answer №1

To improve the layout, simply remove grid-row: 1/ 3;

CHANGE TO

    .item1 {
    grid-row: 1 / 2;
}

In addition, you need to adjust the width of the container. You can either set it to 100% or choose a width larger than 5x250=1250.

Refer to this for more details. P.S. A extra image of the same item has been included.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

List that dynamically changes in HTML email template

I'm currently working on an email template using HTML, and I've run into a roadblock while trying to create a list based on Java code data. The challenge is that the length of the list varies each time. Here's what I tried: <span st ...

`Enhance Image with a Fresh Hue`

Let me explain my dilemma: I'm dealing with a two-tone png image - one tone is black and the other is transparent. Right now, I'm relying on the background color attribute to dynamically change the color of the transparent section. However, I ...

Function in jQuery to reference two different divs

I'm currently facing an issue with a code snippet that I have. The requirement is for the user to be able to hover over "Div 1" and/or "Div2" and trigger a red border around both elements simultaneously. Due to the complexity of my WordPress theme, th ...

What's the best way to create an onclick event for a li element that includes a pseudo-element ::before

I have successfully created a Timeline using HTML and CSS elements. The visual result is as follows: My goal is to enable users to click on the second circle, triggering a color change in the line that connects the first and second circles. This color tra ...

Chrome compatibility problem with scroll spy feature in Bootstrap 3

Having trouble with scroll spy for boosters using the body method " data-spy="scroll". It seems to be working for some browsers like Edge and Google Chrome, but after multiple attempts, it still doesn't work for me. Even after asking friends to test i ...

Emphasize the interactions within the table cells based on their corresponding column and row

I'm looking to achieve a specific interaction in my Angular Material table. I want to highlight the table cell interactions with column and row by extending the highlighting up to the column header and left to the row header. Is this something that ca ...

The page fades in as soon as it is loaded thanks to the "

I am interested in creating a unique effect where different classes fade in on page load. Check out this webpage for reference. The linked page showcases squares in various shades of grey and color, with the desire to have them fade in at different inter ...

Verify that all elements sharing a common class are concealed

I'm facing a simple issue where I have a list with identical class names. When one of them is clicked, it animates out of the container and then redirects you. The list also includes a hide button. My goal is to receive a browser alert when all items ...

Determine the starting position of a div's CSS bottom using jQuery before the hover animation begins

Currently, I am in search of the CSS value 'bottom' for each div that belongs to the 'shelf-info-text' class. These particular divs can be found inside a parent div called 'shelf-item'. The bottom value is determined automati ...

iPad screen not displaying overflow for x and y axis

I'm encountering an issue with displaying the scrollbar on a div while using an iPad device. Currently, I am utilizing: -webkit-overflow-scrolling: touch; Although this is functioning properly, my goal is to have the scrollbar visible without the ...

Edge and Internet Explorer fail to recognize the :focus CSS selector

I am utilizing CSS to make our placeholders jump up when clicked inside, but Edge is not recognizing the CSS. It works fine on every other browser except for Edge. I've tried various solutions but none seem to work on Edge. Any thoughts on what might ...

:after functionality not operating properly in Internet Explorer

The titles on this page have arrows displayed before them using a special styling. However, there seems to be an issue with how it displays on Internet Explorer. // edit : I made a mistake, my styling is actually on paragraph tags 'p'. Maybe tha ...

What is the best way to attach multiple files in PHP using mail.php and mime.php from Pear library?

I am having trouble attaching multiple files. When I try to attach more than one file, only one file gets sent in the email even though I attached multiple files. if(isset($_POST['upload'])){ include('config.php'); include_once ...

Design a CSS floating div with a captivating bubble effect

My current setup includes a DIV element styled as follows: <div class="modal"></div> .modal { position: fixed; z-index: 999999; right: 310px; top: 67px; width: 431.6px; height: 550px; border-radius: 25px; box-s ...

Is your CSS not reflecting changes in Node.js?

I am having trouble getting the CSS to update in the browser using Browser Sync via Gulp on Node.js. What could be the issue? Below is my Gulp.js file: var themename = 'playtest haha 1'; var gulp = require('gulp'), // Prepare ...

Stop the click event from firing on child elements of a parent element that is currently being dragged

Below is the structure of a UL tag in my code: <ul ondrop="drop(event)" ondragover="allowDrop(event)"> <li class="item" draggable="true" ondragstart="dragStart(event)" ondrag="dragging(event)"> <div class="product-infos"> ...

What methods can I use to minimize the frequency of the blue box appearing around text?

I successfully developed code that enables user interaction with text, triggering the opening of a modal box when clicked. In this modal box, the text turns red upon clicking, indicating activation of a checkbox. However, I notice that every time I intera ...

Text in React Native exceeding one line is causing it to extend beyond the screen boundaries

I am having trouble displaying the last messages in my simple contact list as the text is getting cut off the screen. Below is the code I am using: (the readableTimestamp should be positioned behind the text.) View style={{ fontSize: 16, backgro ...

Transitioning from a see-through navigation bar to a vibrant colored menu as

I consider myself a novice when it comes to JavaScript. My goal is to create a Transparent Menu that smoothly transitions from transparent to white with a box shadow as I scroll down the page. However, the JavaScript code I have implemented does not seem ...

A web address shared in a post appears within the nested frame of an iframe

I'm encountering a somewhat confusing issue. I am attempting to submit a URL to an iframe located on the same page. Upon clicking submit, the iframe replicates the current page, but with the correct URL displayed in the duplicated iframe. It's ma ...