I have a loop displaying specified amount of cards.
The problem is with ma-5 attribute in <v-flex>. On xs screen size this margin is too big. Ho do I specify a different margin for different screen sizes?
<v-container> <v-layout row wrap> <v-flex xs12 sm6 md4 ma-5 v-for="card in filteredCards" :key="card.id"> <v-card flat class="elevation-20 test"> <v-card-media :src="card.image" height="200px"> </v-card-media> <v-card-title primary-title class="pa-4"> <div> <h3 class="headline mb-0">{{card.title}}</h3> <div style="min-height:50px;">{{card.description}}</div> </div> </v-card-title> </v-card> </v-flex> </v-layout> </v-container> I tried adding this code below (copied from this page)
<v-flex xs12 sm6 md4 v-for="card in filteredCards" :key="card.id" :class="{'ma-0': $breakpoint.smAndDown, 'ma-5': $breakpoint.mdAndUp}"> and I get these errors:
[Vue warn]: Property or method "$breakpoint" is not defined on the instance but referenced during render
[Vue warn]: Error in render: "TypeError: Cannot read property 'smAndDown' of undefined"
TypeError: Cannot read property 'smAndDown' of undefined
To set the height of Vuetify card with Vue. js, we can set the height prop of the v-card component. to set the height prop of the v-card component to 100% to set the height of the card to 100%.
The v-spacer component is useful when you want to fill available space or make space between two components.
$vuetify.breakpoint.smAndDown
Notice $vuetify
In your case:
<v-flex v-for="card in filteredCards" :key="card.id" :class="{'ma-0': $vuetify.breakpoint.smAndDown, 'ma-5': $vuetify.breakpoint.mdAndUp}" xs12 sm6 md4 > Check docs (Breakpoint object)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With