What causes the "v-col" width to suddenly alter after adding the "bg-red rounded" class?

I'm struggling to organize the data into blocks using Vuetify. When I apply the "bg-red rounded" class to the "v-col", it alters the width of the column, resulting in an undesired grid structure.

Here is the template section of my Vue file. Some data has been omitted for confidentiality reasons.

<template>
  <v-container>
    <v-row>
      <v-col>
        <v-container class="bg-red rounded">
          <v-list class="bg-red font-weight-bold pa-0">
            <v-list-item>
              <v-row col="12" no-gutters>
                <v-col cols="6"> CODE </v-col>
                <v-col cols="1"> {{ `\t:` }} </v-col>
                <v-col cols="5"> 5568 </v-col>
              </v-row>
            </v-list-item>
            [Other data here]
          </v-list>
        </v-container>
      </v-col>

      <v-col>
        [More similar formatting]
      </v-col>
    </v-row>

    [Additional content]

</template>

https://i.sstatic.net/EDKbdHhZ.png

My goal is to add a background color to the empty space in the left column without affecting its width. However, when I try adding background color to both columns, the column widths shift. https://i.sstatic.net/B0sAnQzu.png

Why does this occur? And what is the best method to layout these grids in a visually pleasing way (ensuring that the top block's width matches the bottom block's width)?

Answer №1

The appearance of the v-col remains consistent in terms of size and shape, but it becomes clearer when a red background color is added.

Your initial screenshot actually displays the dimensions of the inner v-container, which does not utilize the full height of the v-col and is horizontally constrained by padding.

The red background on the v-col fills the space that was previously empty within the v-container. You can verify this using your browser's DOM inspector.

https://i.sstatic.net/Um6JrZNE.png

To maintain the spacing between columns, you could resolve this issue by incorporating the background-clip CSS property, ensuring that the background color does not exceed the element's padding area.

<style scoped>
.v-col.bg-red {
  background-clip: content-box;
}
</style>

Check out the Vuetify Playground example

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

Is it possible for us to customize the angular material chip design to be in a rectangular shape

I recently implemented angular material chips as tags, but I was wondering if it's possible to customize the default circular design to a rectangle using CSS? ...

Is it possible to customize the background color for particular days in FullCalendar?

How can I set background colors for specific days? While experimenting, I discovered this method: $('.fc-day15').css('backgroundColor','black'); The only issue is that the colors appear on the 16th day in the calendar grid, ...

VueJS can manipulate an inline template by dynamically changing its content and reinitializing

this particular query shares similarities with the discussions on VueJS re-compiling HTML in an inline-template component as well as How to implement Vue js directive in an appended html element Regrettably, the approach suggested in those threads is no l ...

The parameters for Vue.js @change events are consistently returning as 0 whenever a file is uploaded by clicking on the picture

Check out my JSFiddle here:: https://jsfiddle.net/includephone/o9gpb1q8 I've encountered an issue involving the @change event on an input field. My goal is to create a carousel of images with 4 images per slide. Data Object Structure data: functio ...

What is the best way to adjust the position of a dropdown menu in Material UI?

I am currently working on a Gatsby application and I'm trying to achieve a dropdown menu effect when the Menu icon is clicked, with the menu appearing right under the header and expanding to 100% width. Below is the code snippet that I have been using ...

Calculating the width of div elements within a horizontal gallery that includes a scrollbar

My website, vladimirvojtela.com, features a gallery with a horizontal scrollbar that leaves whitespace at the end due to the width parameter in the code. Can anyone suggest a script that can automatically adjust the DIV width after all images have been ren ...

Vuetify TreeView not displaying properly

I'm new to Vue and I'm having trouble creating a selectable tree. Instead of buttons, words are being displayed. I've tried everything I can think of but I can't seem to fix it. https://codesandbox.io/s/vue-template-v9lje?fontsize=14&a ...

Is it possible to have a hidden div box within a WordPress post that is only visible to the author of the

How can I create a div box with "id=secret" inside a post that is only visible to the author of the post? I initially made it for the admin, but now I want the id to be visible exclusively to the post's author. For instance: If the author is curren ...

Transforming CSS Styles of Elements with Bootstrap

After incorporating links and scripts for Bootstrap v4.5 into my project, I quickly noticed that it automatically overrides the styles of text, buttons, and other elements I had previously customized. While I added a Bootstrap alert for authentication pur ...

The Vue Firebase Storage delete image function is encountering an error stating that the user does not have the necessary permissions to access

Below is the delete method being used: async deleteAvatar(path) { console.log({ path }); try { const imageRef = ref(storage, path); console.log({ imageRef }); await deleteObject(imageRef); } catch (error) { ...

Merge identical data into a unified field within a table

I have a table that displays different colors and their quantities. I would like to merge rows with the same color into one row, with the total quantity shown in that row. For instance, if there are 2 "black" colors with quantities of 5 and 2, I want to c ...

Loading components in Vue Composition API can be done by using the `import` statement followed by

Trying to install the vue3-burger-menu library, but the provided documentation is only compatible with the Options API. However, I am using the Composition API and need some assistance. The documentation provides the following code snippet: import { Slide ...

Creating a bar chart in Chart JS using an array of data objects

I need to create a unique visualization using a bar chart where each bar represents a user or student. Each bar will have an xAxis label displaying the student's name. The code below is a VueJS computed property named chartData For my bar chart data ...

What is the best way to customize the appearance of an XML snippet using Greasemonkey?

I am attempting to customize an XML fragment retrieved from a server response using a Greasemonkey script. Take a look at this sample XML fragment from w3schools.com: <note> <to> Tove</to> <from>Jani</from> <heading ...

The input field cannot be accessed via touch on mobile devices

<div class="form-group row pswrd" style="padding: 0px 10px"> <div id="email" class="col-md-12 col-xs-12"> <input type="password" class="form-control c_fname" id="c" #pswd name="password" placeholder="password" [(ngModel)]="user.passwor ...

Retrieving JSON data from an Axios request in VueJS

I set up a simulated server in Postman to fetch some test data for my Vue application. This is the response I am receiving from the server: https://i.sstatic.net/uhsyS.png I am struggling to access the data information. Here is the code snippet that I am ...

What advantages do CSS pre-processors (SASS, SCSS, LESS) bring to the table for creating Responsive Web Designs?

Currently, I am embarking on a Responsive Web Design (RWD) project and contemplating whether integrating LESS would streamline the process. Are there practical benefits to utilizing CSS preprocessors for RWD projects? I suspect that employing media qu ...

What could be causing the unexpected gap between the first two elements and the third in my flexbox layout?

I am facing an issue with the layout of my third child element. Instead of appearing below the first two children, it is wrapping around to the bottom of the container. Can anyone explain why this is happening and suggest a solution? Even though I have se ...

Animating Divs with jQuery to Expand their Size

I am currently designing a services page for my portfolio website. The layout consists of three columns, with the central column containing a large box and the left and right columns each containing three smaller boxes. These smaller boxes function as clic ...

Stop images within contenteditable divs from being easily dragged and dropped into unrelated div elements

In order to maintain data integrity, I have implemented a rule where users are allowed to drag images within a specific div. Later on, I need to retrieve the positions of these images within the div. However, it is crucial for my business requirements tha ...