I am having difficulty creating grid-template-columns in Vue

When I placed my code in the style scoped section...

This is the desired output that I'm aiming for:

.user-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-gap: 1rem;
}

.user-card {
  padding: 1em;
  color: #f2f2f2;
  background: #1abc9c;
  border-radius: .25rem;
}
<div class="user-grid" v-for="user in allUsers" :key="user.id">
  <div class="user-card" v-if="user.client_id === $route.params.id">
    {{user.name}}
    {{user.email}}
    {{user.phone}}
  </div>
  <div class="user-card" v-if="user.client_id === $route.params.id">
    {{user.name}}
    {{user.email}}
    {{user.phone}}
  </div>
  <div class="user-card" v-if="user.client_id === $route.params.id">
    {{user.name}}
    {{user.email}}
    {{user.phone}}
  </div>
</div>

Note: Disregard the CSS code as I'm only trying to illustrate the output from Vue/Nuxt.

However, in Vue/Nuxt, I am seeing something different:

https://i.stack.imgur.com/ZgirC.png

I attempted to modify auto-fit minmax to auto-fit, minmax(200px, 200px) and while the size was correct, the layout did not adhere to the rule.

How can I properly apply the grid display in a Vue/Nuxt application?

Answer №1

My Vue class is no longer within the v-for loop.

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

From where was this color of the navigation bar derived?

As I delve into a site previously worked on by someone else, my task is to recreate the navigation they implemented. However, I am unable to locate in the source code what was used for the navigation background. The challenge lies in the fact that after m ...

Step-by-step guide for setting up vuetify within Laravel 9 starter kits

Currently, I am in the process of setting up Vuetify within my Laravel 9 project that utilizes the Breeze Vue starter kit. Can anyone provide guidance on how to properly install Vuetify? Should I directly install it into the project, or is there a specifi ...

Is it possible to have CSS handle only horizontal overflow?

Can CSS 2.1 be used to achieve horizontal overflow only? overflow: auto; If this code will result in both vertical and horizontal scrollbars for a block element, is there a way to display only horizontal scrollbars (for example, within a <div>)? Ho ...

The most effective method for positioning a child element to the left and top using Flexbox grid

I am currently working on visualizing queues and processes within a system. Each process is associated with a specific queue from which it retrieves data. I aim to create a layout similar to the following: https://i.stack.imgur.com/BXyts.png However, I a ...

What is the best way to distinguish the Footer from the Content?

While I was honing my skills in crafting a website using only HTML and CSS, I encountered an issue. I couldn't figure out how to place the footer beneath the content properly. My goal was to clearly separate each section - header, content, and footer. ...

Issue with Framework7 toggle component's reactivity being ineffective

I am currently utilizing Vue and Framework7 for the development of an android app. Within a list, I have 4 toggles where only one can be active at a time. The active toggle must also be disabled to ensure that there is always at least one active toggle. ...

I encountered an issue where the font awesome icons failed to load on my website

My website is experiencing an issue where all the Font Awesome icons are not displaying despite having added Font Awesome. Here is the link to my site: https://i.stack.imgur.com/RcNtv.png .login-top .lg-in::before { font-family: "Fontawesome"; ...

Is there a way to make those three elements line up in a row side by side?

I'm working on a layout using HTML and CSS that will display two images on the left and right sides of the browser window, with text in between them. I want them all to be horizontally aligned within a container. Here is the code snippet: <div cla ...

Price Adjuster Tracker

Recently, I coded a small JavaScript program with the purpose of: incrementing or decrementing the quantity of an item by 1 adjusting the price of an item based on the initial price However, my excitement turned to disappointment when I encountered these ...

How to toggle checkboxes in Vue.js

I received a JSON response that looks like this: {"roles":[{"id":1,"name":"Super Administrator","guard_name":"web","created_at":"2020-03-07T14:51:34.000000Z","updated_at":"2020-03-07T14:51:34.000000Z","permissions":[{"id":1,"name":"user create","guard_nam ...

Is there a way for me to manage the appearance of the printed document's layout?

I have successfully added 3 print buttons to my website, each one designed to print a specific portion (div) of the webpage. Here is the code snippet for this functionality: function printPage(id) { var html="<html>"; //html+="<link rel="st ...

Tips for asynchronously modifying data array elements by adding and slicing

I am facing an issue in my vuejs application where I need to modify an array of items after the app has finished loading. My current setup looks like this: var n = 100; var myData = []; function loadMovies(n){ // async ajax requests // add items to ...

Implement Vue.js transitions on elements to smoothly reveal additional content

Rather than a problem, this is more of a "how to" scenario. Imagine having a template structured like this (id tags are used for clarity) : <template> <div id="1" v-if="someCondition"></div> <div id="2" ...

What methods can be used to modify the appearance of the cursor depending on its position?

Is there a way to change the cursor to a left arrow when on the left half of the screen and switch it to a right arrow when on the right half, using JavaScript? I am trying to achieve something similar to what is shown on this website. I attempted to acco ...

Generating a PDF from a CSS3 multi-column layout with the help of snappy (a wrapper for wkhtmltopdf)

I am attempting to create a PDF with three columns using barryvdh/laravel-snappy and wkhtmltopdf. Since the text that will populate these columns varies in length, I need a method that allows the text to flow freely within the columns. I have attempted to ...

JavaScript problem with hovering action causing additional buttons to appear

Currently, I am developing a user interface where, upon hovering over an LI element, 2 buttons appear to provide additional functionality - "edit" and "remove". However, I am facing challenges with the mouse hit zones. The mouseover function works effect ...

Every time I attempt to use $router push, an error is generated

I've encountered an issue while trying to push the router using vue-router. this.$router.push({ path: '/' }).catch(() => {}); The error message reads as follows: app.js:43636 Uncaught TypeError: Cannot read property 'classList' ...

Sophisticated filter - Conceal Ancestry

Check out this snippet of my HTML: <td> <a class="button" href="#"> <input id="download">...</input> </a> <a class="button" href="#"> <input id="downloadcsv">...</input> </a> </td> I am ...

The functionality of scrolling ceases to work once the bootstrap modal is closed

I am utilizing Bootstrap v3.1.1 to showcase a modal popup on one of my web pages. The following code shows how I have implemented it. <!--Start show add student popup here --> <div class="modal fade" id="add-student" tabindex="-1" role="dialog" a ...

Adding text to a Video Js fullscreen window on an iPad

Looking to enhance user experience on iPad while using a video js player, I want to make an image pop up upon completion of the video. Currently, I have it set up to work without full screen mode, but iPad users prefer watching videos in full screen. Is th ...