Styling your Vuetify V-data-table with CSS

Struggling to add extra spacing between table rows, despite inspecting the page and verifying that my styles are not being overridden. Have read other Vuetify posts on applying CSS but still no luck. Any suggestions for why I can't style my table as desired?

Custom Style:

`<style scoped>
    >>>tr {
        border-spacing: 10px;
        border:none;
    }

</style>`

Screenshot of Console Error: https://i.stack.imgur.com/84tPX.png

Data Table Component Code:

<template>
    <v-data-table :headers="headers"
                  :items="posts"
                  :items-per-page="5"
                  hide-default-header
                  item-key="post_id"
                  class="elevation-1 browseTable"
                  :footer-props="{
      showFirstLastPage: true,
      firstIcon: 'mdi-arrow-collapse-left',
      lastIcon: 'mdi-arrow-collapse-right',
      prevIcon: 'mdi-minus',
      nextIcon: 'mdi-plus'
    }">
        <template #item.full_post="{ item }">
            <p>{{ item.title }}</p>
            <p>{{item.body }}</p>
        </template>
    </v-data-table>
</template>

Answer №1

When styling a table, it is important to apply the border-spacing property to the table element, rather than the tr. Additionally, ensure that you have border-collapse: separate; set for it to take effect. While this is typically the default setting, Vuetify may potentially override it.

>>> table {
  border-spacing: 10px;
  border-collapse: separate;
}

If you are looking to remove borders completely with border: none, it is likely applied at the td level. To target this style specifically, use:

>>> table td {
  border: none;
}

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

Issues with Vue js not updating the DOM

I am currently working with multiple components: A, B, and C. In component A, there is an array that plays a crucial role in the flow of data. When an item is selected in component A: An emit event triggers a method in component B that displays the lengt ...

Issue with passing a prop in Vue 3

I'm attempting to send a simple prop to another component in Vue 3.0.11, but for some reason, I can't seem to make it work. Here's the code snippet from my App component: <template> <Loading :message="Importing"></ ...

In a React application, adjusting the main container height to 100vh results in the window.scrollY position being set to

I was facing problems with flashing on the Safari/Firefox browsers. By setting the main container height to max-height: 100vh, I managed to resolve the flickering issue. However, I am also looking for a solution to keep track of the window.scrollY positi ...

Tips for previewing files before uploading them to a server utilizing the file-upload feature of vue.js and element-ui

I am currently utilizing vue.js and element-ui for file uploads and previews. My goal is to be able to preview files (.pdf/.docx/.jpg, etc.) before they are uploaded to the server. <el-upload ref="uploadFile" :on-change="onUploadCh ...

Add elements from one array into designated positions within another array

Is there a way to extract the days and months from the current week and store it in an array within a specific field of an object? I need to be able to later iterate through this array to display the data. I am unsure on how to achieve this. <div v-for ...

Disabling CSS transitions and attempting to alter the style of an HTML element using JavaScript may not consistently work as expected

Currently, I am in the process of creating an animated effect for a website that involves moving two elements' positions over time and resetting them to their original position. Only one element is displayed at a time, and the animation should run smo ...

Extract latitude and longitude data using Mapbox's autocomplete feature

Currently, I have integrated Mapbox with autocomplete in a Vue component: <template> <div> <div id='geocoder'></div> </div> </template> <script> import mapboxgl from 'mapbox-gl& ...

What is the best way to create a design with an image on the left and text on the right side?

I am trying to create a layout that features an image on the left and text on the right in a specific structure: Item 0: value 0 Item 1: value 1 Item 2: value 2 However, the text is appearing all in one row like this: Item 0: value 0 Item 1: value 1 Ite ...

Guide to developing a Microsoft Teams tab application using the VueJS framework

I'm in the process of configuring a teams app using VueJS, as my project is based on it. My attempt to create a teams app with Visual Studio and integrate VueJS into it has not been successful. The components don't work properly and imports are ...

Is it possible to adjust text wrapping based on the size of the screen?

I am currently facing an issue with my modal form where the text does not wrap properly depending on the size of the modal form. I need help with correcting this using CSS. My current approach involves using angular with new lines and hardcoding line brea ...

You can eliminate the display flex property from the MuiCollapse-wrapper

Having trouble removing the display flex property from the MuiCollapse-wrapper, I did some research and found the rule name for the wrapper in this link https://material-ui.com/api/collapse/ I have been unsuccessful in overwriting the class name wrapper t ...

Centered vertically on the right side of a div, a CSS arrow is positioned

Hello, I am seeking a way to vertically center a CSS triangle/arrow on the right side of a div using pure CSS. Unfortunately, I can't include images due to my low reputation. Currently, my code is not functioning properly and lacks cross-browser comp ...

Centered Bootstrap 4 modal with responsive width

Struggling to create a BootStrap 4 Modal that is centered in the screen and adjusts its width based on content? You're not alone. Despite trying different approaches like the container fluid and CSS methods, achieving a variable width modal is proving ...

Using Typescript inject with Vue 3 is currently not functioning as expected. The issue arises when trying to create spread types from object types

When using Vue 3 and TypeScript, an error is encountered (as shown below) only when the script lang="ts" attribute is present. Can someone provide insight into why the inject function in Vue 3 with TypeScript does not function correctly? ERROR in src/compo ...

Bootstrap's versatile footer positioning adaptation

I am working with a simple layout design: +----------+ | Header | +----------+ | | | Content | | | +----------+ | Footer | +----------+ My goal is to ensure that the footer is positioned: at the bottom of the viewport when there ...

Emulate the CSS hover effect with jQuery 코드 희미한

Is there a method in jquery or any other technology that can detect event X and trigger a different event elsewhere? Currently, I am working with an image that has an image map. When a user hovers over a specific area on the map, I would like another part ...

Trouble aligning content in CSS? Try using justify-content center for perfect centering!

I am facing an issue with centralizing the content properly. Despite using justify-content:center, the layout breaks. When I apply justify-content:center, the layout appears like this: Here is the HTML / JSX code snippet: <div className={styles.co ...

Can cells within an HTML table be crossed out?

I have a creative idea for an HTML table - I want to be able to cross out cells in a way that looks like the following drawing: At first, I thought about creating a CSS right triangle within the cell. But I got stuck when trying to only color the hypotenu ...

Implementing the Same Vue Component with Different Path Names

Is there a more efficient way to have different URLs (Consumer and Seller) for the same SingleProduct component? The initial method works well: const routes = [ { path: "/:name", name: "SingleProductSeller", component: SingleProduct }, { ...

Creating a personalized interface in Node-RED using a combination of node-red-contrib-uibuilder, VueJS, and importing additional packages

I am utilizing node-red to capture data from sensors and store it in a database. Furthermore, I intend to use it for data visualization purposes. To achieve this, I am employing node-red-contrib-uibuilder, which, to my understanding, leverages VueJS. Every ...