'I want to make v-card transparent, but it doesn't work right
I want that v-card be transparent, but what is inside it should not be transparent. How can I make it with CSS?
card.vue
<v-card class="cardColor">
<v-card-text>
TEXT
</v-card-text>
<v-card-actions>
<v-btn color="primary" @click="foo">Button</v-btn>
</v-card-actions>
</v-card>
common.css
.cardColor {
background-color: white!important;
border-color: transparent!important;
opacity: 0.65;
}
I tried to write this, but it doesn't work.
.cardColor {
color: rgba(255, 255, 255, 0.5);
}
Solution 1:[1]
you can use color property with outlined
<v-card outlined color="transparent">
...
</v-card>
Solution 2:[2]
if you want a card with transparent background, you can choose one of these options:
add flat property to your v-card component, and set color="transparent".
<v-card flat color="transparent"> ... </v-card>add flat prop to your v-card and add the following style:
<v-card flat style="background-color: transparent;"> ... </v-card>
Solution 3:[3]
In CSS, we can achieve it by the following style:
.cardColor
{
z-index: 1;
position: relative;
width: 100%;
float: left;
}
.cardColor:before
{
position: absolute;
content: "";
display: block;
width: 100%;
height: 100%;
background: #fff;
opacity: 0.35;
top: 0;
left: 0;
z-index: -1;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Ali |
| Solution 2 | Alireza Bahrololoom |
| Solution 3 | Lee Taylor |
