There are numerous grid cells that are struggling to auto place themselves in the correct positions

Check out the Vue code snippet below:

<template>
    <div class="live-room-list">
        <div class="test">
            <div
                class="item"
                v-for="(item, index) in list"
                :key="item.height"
                :style="{
                    'grid-row': `span ${Math.ceil(item.height)}`
                }"
            >{{index+1}}: {{item.height}}</div>
            
        </div>
</template>

<script>

export default {
    data() {
        return {
            list: Array.from({ length: 10 }).map(_ => {
                return {
                    height: Math.random() * 300 + 10
                };
            })
        };
    }
};
</script>

<style lang="scss" scope>

.test {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-gap: 0 5px;
    grid-auto-flow: row dense;
    grid-auto-rows: 1px;
}

.item {
    border: 2px solid rgb(226, 199, 77);
}
</style>

When I specify a small value for length, everything works fine. However, if length is set to a large number, the cells start to overlap like this:

What could be causing this issue?

I've tried searching on Google for similar cases but couldn't find any relevant explanation.

Answer №1

If the issue lies in the overlapping (vertical) borders, consider adjusting the row gap within your grid-gap settings.

.test {
  grid-gap: 5px 5px;
}

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

Tips for aligning text beneath a CSS-created box

Lately, I've been diving into coding to expand my knowledge of HTML and CSS. So far, I haven't delved into JavaScript just yet. Currently, I've encountered a challenge. While trying to replicate a PSD file layout into HTML, I need to create ...

Ways to gradually adjust the height of a Div element

Is there a way to smoothly reveal a Div when scrolling down and clicking on a button? Currently, it seems to just appear quickly without any sliding effect. What could be causing this issue? function showstuff(inquiryForm){ document.getElementById(inq ...

Instructions on how to upload and display an image on a Konvajs canvas

I have utilized the konva.js plugin for creating a canvas representation. Despite reviewing the documentation, I am unable to find any guidance on uploading images using konvajs. Do I need to write custom code for this functionality? Can konva.js facilita ...

Storing a chosen avatar in a database: A step-by-step guide

I am looking to display a selection of 10 avatars on my website for users to choose from. There will be no option for users to upload their own avatar. Users will simply click on the avatar image they want and then click the "done" button. The selected ava ...

Challenges encountered while attempting to animate the CSS clip feature in WebKit

I've been searching everywhere for a solution to my issue, but none of them seem to work. As someone new to CSS3 Animations, I appreciate your patience. I created a simple animation using CSS3 that functions perfectly in IE and Firefox, however, it ...

Align text vertically within Bootstrap carousel area

I'm struggling with centering text both horizontally and vertically in a Bootstrap 4 carousel. I've set up the bootply with a carousel, but the text is stuck in the upper left corner instead of being centered on the screen. <div class="carou ...

Create curved edges for the divs inside other divs

I am currently working on creating rounded corners for my responsive table using div elements. However, I am encountering an issue where the top part of the div is not being rounded as expected. Here is a preview of my current progress: https://i.sstatic. ...

upon reaching the conclusion of the animation without employing the .animate() method

I'm currently working on developing an iPad web application. The .animate() method doesn't meet the necessary speed requirements, so I've opted to utilize CSS for most of my transitions. How can I go about implementing html <div id="myG ...

What is the best way to constrain the ratio of a full-width image display?

I am in need of a solution for displaying an image at full width inside a frame with a 16:9 aspect ratio. The image needs to be centered within the frame and adjust responsively when resizing the screen. My preference is to achieve this using just CSS. ...

What could be causing the <a> tag inside the <nav> element to lose a few pixels in width?

I'm currently working on crafting a responsive menu for a website, but I've encountered an issue: The a tag (red color) seems to lose a few pixels when setting the width of the div (blue color). To spot this discrepancy, you'll need to acce ...

The directional arrows for sliding in Vue-Slick are not showing up on the Vue.js component

I have integrated vue-slick(v-1.1.15) in vuejs to display sliding images along with arrows for manual navigation. However, instead of the expected arrow buttons, "Next" and "Previous" buttons are appearing. Even after importing the .css file for vue-slick ...

My goal is to develop a PHP photo gallery using either an array, session variables, or cookies

I am in need of a solution for my issue. https://i.stack.imgur.com/Xe65l.png The image shows the front end, and I require a corresponding function to be developed for it. ...

Issues with implementing Bootstrap 4 navbar on a Rails 5 application

I'm currently in the process of transitioning my static HTML/CSS/JS website to a Rails application. Using Bootstrap 4, I had all the functionality and CSS classes working perfectly on the static site. However, after the migration to the Ruby app, the ...

Challenges with JSON and conditional rendering in Vue.js

Upon clicking the Add button in the example below, it appears that neither of the v-if related divs are rendered. It seems that Vue.js is not updating when the pizzas JSON object is modified. Is there a way to address this issue without converting the piz ...

There seems to be an issue with the implementation of the border-radius-top-left property in

I'm having trouble getting my button to curve at specific corners in my NativeScript App. Below is the CSS code I've used: border-bottom-left-radius: 10; border-top-left-radius: 10; border-top-right-radius: 0; border-bottom-right-radius: 0; I h ...

Unusual actions observed when using CSS pseudo selector :checked

I have implemented a unique CSS solution to showcase a five-star rating system on my website. The method I followed can be found at . While this technique works flawlessly in some sections of my website, it strangely fails in others. Could this be due to c ...

The CSS code seems to be ineffective when attempting to center elements with a specific width in react.js

Hey everyone, I'm currently working on developing a web application using react-bootstrap and I've encountered an issue with adjusting the width of my row and centering it. I have already created the necessary CSS and JS files, but I am unable to ...

Adjusting element placement on collapsed navbar using Bootstrap

I've been developing a navbar for a webpage and have successfully aligned the data left and right with the Brand in the center. However, when the navbar collapses, the alignment shifts to Left (over) Brand (over) Right. I want the Brand to remain at t ...

CSS: dealing with content that spills outside of a div

Currently, I am struggling to identify the solution to a problem on my website but I am unsure of how to categorize it. If you would like to take a look, here is the link: The issue at hand involves having a webpage divided into 3 standard sections: top, ...

How can I turn off a CSS transition for a particular line of code?

Hey there! I'm dealing with a div that has a fixed height, but when hovered over, it expands by a specific amount. I've also managed to make the background color change upon hovering over the div. The issue arises when both the height and backg ...