[Vuejs]-V-btn (floating action button) positioned absolute top does not overflow from v-card (Vue2, Vuetify)

3👍

Check your CSS – your card is having overflow: hidden. Remove this CSS rule and it will work as expected.

new Vue({
      el: '#app',
      template: '#main',
      vuetify: new Vuetify(),
    })
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
<div id="app"></div>
<template id="main">
<v-app>
<v-main class="pa-8">
<v-row justify="center">
<v-card>
  <v-btn @click="dialog = false" fab small absolute top right class="error">
    <v-icon>
      mdi-close
    </v-icon>
  </v-btn>
  <v-card-text>This is some example text</v-card-text>
</v-card>
</v-row>
</v-main>
</v-app>
</template>

1👍

You can override the style using vue’s CSS deep selector (>>>). Judging by your code, the overflow style must be coming from the v-dialog class (@click="dialog = false", I take for granted you’re trying to close a dialog on the click of that button), so just add this to the vue component :

<style scoped>
  >>> .v-dialog {
    overflow-y: visible;
  }
</style>

The ‘>>>’ makes it so the overflow-y property of the v-dialog class is going to be overriden.

Leave a comment