2

I'm trying to change border-spacing iin the v-data-table to:

border-spacing: 0 0.5rem;

I tried setting it with css:

v-data-table > div > table {
  border-spacing: 0 0.5rem;
}

or

.v-data-table table {
  border-spacing: 0 0.5rem;
}

But both of those did not work. Any idea how can i change space between rows in v-data-table?

4
  • It will not work if you do it in the <style scoped></style> Commented Mar 4, 2020 at 12:56
  • it works fine here Commented Mar 4, 2020 at 13:01
  • adding border-spacing it works on vuetify table Commented Mar 4, 2020 at 14:31
  • @Mr.Perfectionist oh, so it is not possible without scoped? I need to contain the rest of the css in that component inside it so I need to use scoped. Commented Mar 4, 2020 at 14:39

2 Answers 2

3

You need to use the deep css selector >>> to do CSS injections into other components.

For example,

.a >>> .b { /* ... */ }

will be compiled down to

.a[data-v-f3f3eg9] .b { /* ... */ }

So you probably want to do something like

v-data-table >>> div > table {
  border-spacing: 0 0.5rem;
}
Sign up to request clarification or add additional context in comments.

Comments

1

You can add below selector

.v-data-table > .v-data-table__wrapper > table {
    border-spacing: 0 0.5rem;
}

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.