A CSS grid displaying a single column rather than the specified repeat of five columns each with a width of 120 pixels

Utilizing a CSS grid, I have created a gallery to display images. Below you will find the HTML code:

  <template>
    <div class="images-grid">
      <div v-for="image of images" :key='image.src' class="img-container"&grt;
        <img :src="image.src">
      </div>
    </div>
  </template>

As well as the corresponding CSS styling:

  .images-grid{
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, 120px);
    padding-top: 103px;
    padding-left: 3px;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    opacity: 0;
    overflow: auto;
  }

  .img-container{
    width: 120px;
    height: 120px;
    background-color: aqua;
  }

  .img-container img{
    height: 100%;
    width: 100%;
    object-fit: cover;
  }

The issue arises as the grid is only displaying one column instead of five, similar to this image https://i.sstatic.net/c1voV.png. Attempting to use inline-block resulted in more than five columns being displayed. Is there an error in my approach or does Vue.js handle CSS differently? As someone new to Vue.js, any guidance on correcting this issue would be greatly appreciated.

Answer №1

After some investigation, I finally identified the issue...

I relied on the gsap library for element animations.

Unexpectedly, gsap altered the display property to 'block' during animation, leading to the grid malfunctioning. It was quite a facepalm moment :)

It's funny how I wasted over 45 minutes trying to figure this out!

Big shoutout to Temani for the help.

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

Unable to access Vue3 props from setup() results in empty values

I'm encountering an unusual issue with my Vue3 component. I'm attempting to access a value from the props within the setup() function, but it seems to be returning nothing. <template> <div class="border p-2 space-y-2"> ...

Step-by-step guide on integrating Bulma page loader extension as a Vue component

Is there a way to integrate the Bulma-extension page-loader element as a Vue component in my project? I attempted to import page-loader.min.js and use it, but unfortunately, it didn't work as expected. <template> <div class="steps"> ...

Creating a table with multiple rows condensed into a single row (Using Material-UI/CSS)

Here is the array structure I am working with: const sample = [ { name: 'apple', detail: [{'a', 'b'}]}, { name: 'banana', detail: [{'a', 'b'}]}, ]; In order to create a table similar to the ...

Achieving priority for style.php over style.css

Having trouble with theme options overriding default CSS settings in style.css. Here's what I have in my header.php: <link rel='stylesheet' type='text/css' media='all' href="<?php bloginfo( 'stylesheet_url&apo ...

Swapping stylesheets using a hyperlink - a simple guide

Currently, I am creating a website that utilizes PHP, XHTML strict, and jQuery. The main goal is to ensure the site is adaptable for mobile and desktop devices by implementing the principles of Responsive Web Design. This involves serving different stylesh ...

The waveform's bottom appears distorted when using Bootstrap

I'm currently experimenting with creating a header wave in Bootstrap CSS using SVG shape. However, I encountered an issue when implementing bootstrap into the HTML code - my design resembles the second image instead of the desired look of the first on ...

Unexpected changes are observed in the size of DIV elements when adjusting the SVG viewBox

My aim is to make the <svg> element have the same dimensions for the viewBox as the <div> it is inside. This means that the viewBox values need to match the dimensions of the containing <div>. Here is an example: <div style="width ...

Mobile devices with a horizontal scroll

Having trouble with side scrolling on mobile devices. I've set two @media queries for tablet and mobile. Visit dev.bdbshop.com @media only screen and (max-width: 767px) { .wrap { max-width: 300px; } Could the issue be related to this? Any suggestio ...

How can we map a promise that resolves to foo to a new promise that resolves to bar?

I am working on a function that uses an XMLHttpRequest to retrieve data and returns a promise with the response. But now I want to modify it so that the promise only contains a specific string from the response. Instead of resolving to response = {status ...

A guide to resolving a sinonJS stub issue

Trying to stub a request with SinonJS has been a challenge for me. I set up the mock request before each test to use fake data, but it's not working as expected. I attempted to use Promise.resolve for resolving, but that didn't work out either. ...

Within the body class, text appears with a subtle shadow effect, however, the links within the body also inherit this shadow

I'm encountering a problem in my CSS: body.transparent {background-color: transparent;color:#ffffff;text-shadow: 0 -1px #000, 1px 0 #000, 0 1px #000, -1px 0 #000;} The text-shadow was intended to apply only to simple, non-formatted text. However, it ...

Tailwind CSS not applying styles to my Next.js project on Ubuntu operating system

I'm experiencing a strange issue where Tailwind CSS is not applying any styles to my project on Ubuntu 20.04. Interestingly, the project works perfectly fine on Windows but for some reason, it's not styling at all on Ubuntu. https://i.sstatic.n ...

Place 2 images side by side within a row using Bootstrap's grid system

https://i.sstatic.net/RVBpK.png Is there a way to center the images for the 2 app download links within the class="row" section? <div class="container"> <div class="row"> <div class="col-xs-4" style="text-align:right"&g ...

The dilemma between Nuxt Js global CSS and Local CSS

Currently, I am in the process of developing a Nuxt application utilizing an admin template. While I am well-versed in Vue.js, I am finding the aspect of loading assets within Nuxt.js to be a bit perplexing. I am in the process of converting the admin temp ...

Having issues with the tailwindcss transformation not functioning properly, but the problem seems to resolve when directly incorporating it into the

Lately, I decided to start utilizing tailwindcss and I have noticed that certain properties do not seem to function at all. However, when I incorporate them into my CSS directly, they work perfectly fine. Allow me to provide an example. const Step = styled ...

Despite the use of v-if and v-else directives in Vue 2, a specific component properties are not being updated while the others are updating

Vue2 is not updating one specific component (<Button>) inside v-if and v-else, while the rest of the content is updated. I have recently discovered a solution to make this code function, but I am still unsure about Vue2 re-rendering behavior. I worr ...

Encountering an unknown parse error while working with Typescript, Vue, vue-property-decorator, and VSCode

I am brand new to Typescript and Vue.js, and I haven't been able to find a solution here. The code below is causing a parsing error: '}' expected I have double-checked all the bracket pairs and as far as my eye can see, everything looks co ...

Refresh the block's content seamlessly without the need for a page reload

Within the index.html page There exists a block called content that contains various content blocks. An additional navigation menu with numerous links is present. It is important that when you click on a menu link, the content within the content block re ...

Focus on the iPad3 model specifically, excluding the iPad4

I am looking to apply specific CSS that works on iPad 3, but not on iPad 4, or vice versa. Currently, I am able to target both versions by using the following code: @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( m ...

The request is missing a token

Whenever a page loads (not due to router.push), my Vuex action is executed. This function runs smoothly, checking for the existence of a token and proceeding if it finds one. However, I am encountering an issue when I dispatch another action that relies on ...