Home > front end >  Vue Vuetify center horizontally and vertically
Vue Vuetify center horizontally and vertically

Time:03-16

I'm trying to center my auth component (v-card) horizontally and vertically. I tried all kinds of solutions like justify=center and align=center on the rows, fill-height on the v-container, on the v-container but its not working. What am I doing wrong here ?

Code :

<script setup lang="ts">
import { useUserStore } from "../../stores/user";
const store = useUserStore();
</script>
<template>
        <v-card width="800" >
          <v-card-title>
            Authentication
          </v-card-title>
          <v-card-subtitle>
            login with username and password
          </v-card-subtitle>
          <v-card-text>
            <v-row>
              <v-col cols="12" md="6">
                <v-text-field v-model="store.username" label="Username"></v-text-field>
              </v-col>
              <v-col cols="12" md="6">
                <v-text-field v-model="store.password" label="Password"></v-text-field>
              </v-col>
            </v-row>
          </v-card-text>
        </v-card>
</template>

<script setup lang="ts">
import Auth from "../components/auth/Auth.component.vue"

</script>
<template>
    <v-container>
    <v-row style="border:1px solid red;" fill-height>
      <v-col >
        <Auth/>
      </v-col>
    </v-row>
    </v-container>
</template>

<template>
  <v-app>
    <v-main>
      <router-view></router-view>
    </v-main>
  </v-app>
</template>
<script setup lang="ts">

</script>

CodePudding user response:

Update

Check this codesanbox I made: Preview

  • Related