0

When I am trying to change the v-data-table header font size, it doesn't  change whatever font I am setting. I tried the Chrome developer tool and was able to do that. I don't, and when I copy that nested CSS class pattern to my code and set that font, it doesn't reflect. I tried the reference it didn't work. Below is my code snipped.

vuetify code:

<v-data-table :headers="headers" :items="modifiedFilterValue" :search="search" flat>
<template v-slot:[`item.start_date`]="{ item }">
        <td :class="isLinethrough(item)">
          <span>{{ getUserSessionDate(item.start_date, item) }}</span>
        </td>
      </template> 
</v-data-table>

CSS browser devtool snipped:

enter image description here

CSS Code that I applied:

.theme--light.v-data-table > .v-data-table__wrapper > table > thead > tr:last-child > th{
  font-size: 2px !important;
}

Please let me know if I am doing something wrong.

1 Answers1

0

I am assuming you want to change the font-size of the table header text for all the columns. If Yes, you can achieve that with below CSS code.

.v-data-table .v-data-table-header tr th {
  font-size: 20px !important;
}

Live Demo :

new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  data () {
    return {
      headers: [
        {
          text: 'Dessert (100g serving)',
          align: 'start',
          sortable: false,
          value: 'name',
        },
        { text: 'Calories', value: 'calories' },
        { text: 'Fat (g)', value: 'fat' },
        { text: 'Carbs (g)', value: 'carbs' },
        { text: 'Protein (g)', value: 'protein' },
        { text: 'Iron (%)', value: 'iron' },
      ],
      desserts: [
        {
          name: 'Frozen Yogurt',
          calories: 159,
          fat: 6.0,
          carbs: 24,
          protein: 4.0,
          iron: '1%',
        },
        {
          name: 'Ice cream sandwich',
          calories: 237,
          fat: 9.0,
          carbs: 37,
          protein: 4.3,
          iron: '1%',
        }
      ],
    }
  },
})
.v-data-table .v-data-table-header tr th {
  font-size: 20px !important;
}
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.5.4/dist/vuetify.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vuetify@2.5.4/dist/vuetify.min.css"/>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900"/>

<div id="app">
  <v-app id="inspire">
    <v-data-table
      :headers="headers"
      :items="desserts"
      :items-per-page="5"
      class="elevation-1"
    ></v-data-table>
  </v-app>
</div>
Debug Diva
  • 26,058
  • 13
  • 70
  • 123