Ways to align content in the center using Vuetify3

I have a component positioned at the top of the page, but I would like it to be centered instead.

Something like this:

Here is my current code:

<template>
  <v-container class="align-center" fill-height fluid>
    <v-row class="d-flex justify-center mb-6">
      <h1>Counter <v-icon>mdi-clock-outline</v-icon></h1>
    </v-row>
    <v-row class="d-flex justify-center mb-6">
      <h2>{{ count }}</h2>
    </v-row>
    <v-row class="d-flex justify-center mb-6">
      <v-btn @click="increment" class="mx-5" icon><v-icon>mdi-plus</v-icon></v-btn>
      <v-btn @click="decrement" class="mx-5" icon><v-icon>mdi-minus</v-icon></v-btn>
    </v-row>
  </v-container>
</template>

Could someone please advise me on how to center everything using Vuetify3? Thank you in advance.

Answer №1

Make sure to add the d-flex class names to the container component and enclose v-row components within v-col:

 <v-container class="align-center d-flex" fill-height fluid>
      <v-col>
        <v-row class="d-flex justify-center mb-6">
          <h1>Counter <v-icon>mdi-clock-outline</v-icon>
          </h1>
        </v-row>
        <v-row class="d-flex justify-center mb-6">
          <h2>{{ count }}</h2>
        </v-row>
        <v-row class="d-flex justify-center mb-6">
          <v-btn class="mx-5" icon>
            <v-icon>mdi-plus</v-icon>
          </v-btn>
          <v-btn class="mx-5" icon>
            <v-icon>mdi-minus</v-icon>
          </v-btn>
        </v-row>
      </v-col>
    </v-container>

Check out a demo here

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Laravel 4.2 email template not applying CSS inline style for text color

Working on setting up email functionality in Laravel 4.2 and I've got an email template ready to go. The data for the emails is stored in an array, but I'm running into an issue where if I pass a parameter like $variable, the styles are only bein ...

Exploring the utilization of Array Loops in form validation with Vue

I am seeking to develop a straightforward web app that can validate forms using Vue. There are two input fields, firstname[1] and firstname[2]. data: { firstname: ['',''], } I attempted to use the following code to validate th ...

Placing text beside an image

I am brand new to osCommerce and recently took over this code. We are looking to improve the layout of the new_products page. Here is the current display code: div class="contentText"> <div class="NewProductsList"> <table border="0 ...

Child Component Unable to Access Vue Props

My root element contains logged in user data, which I am passing as props to the user profile component. However, when I attempt to access User object properties in the child component, it throws an error and shows as undefined. In my app.js: Vue.compone ...

Experience the full power of the bootstrap grid system with a unique feature: nested overflow-y scrolling

Struggling with the bootstrap grid and a nested div with overflow-y. I followed advice from this stack overflow post, attempting to add min-height:0 to the parent ancestor, but can't seem to make it work. View screenshot here - Chrome on the left, Fi ...

Using Jquery to set up an event listener on a child div that changes the CSS property of its parent div

I am currently working on a product customization form where the radio buttons are hidden using opacity:0. My goal is to have the border of the image turn black when an option is selected as a visual feedback for the user. I've implemented an event l ...

Having trouble with the post method being not allowed in your SPA Vue on Laravel application? Have you tried

This question has been raised multiple times, with varying solutions that have not proven to be effective. Despite my attempts to set the csrf-token in different ways, I still can't get it to work. My goal is to create a Single Page Application (SPA) ...

Tips for sending a request from a Nuxt.js client through a Nuxt.js server and successfully receiving the response on the client side

I am currently working on a Vue.js application that operates solely on the frontend with no server involved. The app sends multiple requests to various APIs, resulting in its complexity increasing over time. Unfortunately, some of these APIs pose problems ...

Styling the background of a container in CSS using Bootstrap

Currently, I am utilizing bootstrap and trying to find an elegant solution for adding a background to my container. Specifically, I am working with the bootstrap class container, as opposed to container-fluid. The official Bootstrap documentation advises ...

The mysterious anomaly in Vue.js

I am attempting to assign a data object named types upon receiving a response in the ready() method. This is what I have: export default { data () { return { types: null } }, ready () { TypeService.showAll(1) .then(functio ...

How can I retrieve a large API response in Nuxt without causing the page to render slowly?

I have a dynamic page in my Nuxt project where I utilize Fetch and Axios to retrieve all the necessary data, such as photos and text. The issue I'm facing is that the API response is quite long, with more than 3800 lines of code. When loading the pa ...

What is the best way to ensure my buttons hide or display correctly when clicked?

I have been working on setting up an edit button that toggles the visibility of save and cancel buttons. However, I encountered a problem where all the buttons disappear when I click on the edit button. This issue did not occur with my other buttons, and t ...

Looking to reduce the size of a logo image within a container as you scroll down a webpage?

I've been working on creating a logo section for my website, but I'm struggling to make it shrink as users scroll down and expand back to its original size when they scroll up. I've tried various JavaScript and jQuery functions without succe ...

Navigating in a Curved Path using Webkit Transition

Currently, I am working on a simple project to learn and then incorporate it into a larger project. I have a basic box that I want to move from one position to another using CSS webkit animations and the translate function for iOS hardware acceleration. I ...

Struggling to align text to the far left within a text area using Bootstrap

When I accidentally place my cursor earlier in the text area, it starts writing from that point, leaving some unwanted spaces at the beginning. I prefer it to start from the extreme left, similar to how it behaves in input boxes. Below is the code snippet ...

Having trouble building a VueJS project that relies on webpack after deleting the node_modules folder

Recently, I encountered a problem with my web project and attempted to delete the node_modules folder. However, after reinstalling it from scratch, I'm unable to successfully build the project, whether for development or production. Running npm run de ...

The alignment of h2 headings becomes disordered beyond a specific viewport width

Can someone help me with an issue I'm facing regarding the placement of my "rightside" navigation? The problem arises when the viewport width drops below 767px, causing the h2 elements in the rightnav to align themselves directly next to the #leftnav. ...

Tips on personalizing the default html template in nuxt

Struggling to customize the default page from my Nuxt app due to limited documentation. Link to Documentation I'm interested in extracting only certain elements like the title or links in the head section. For example, how can I access just the li ...

Whenever attempting to detach(), I am encountering the following error message: local.ERROR: Call to a member function programs() on an integer

I am dealing with a Many to Many relationship between Courses and Programs. The insertion of new courses and adding multiple programs works correctly. However, the issue arises during updates. When I update a course, I want to detach all related programs a ...

Leveraging CSS classes for enhancing the bootstrap grid system

Forgive me for the seemingly simple question, but here is my dilemma. Presented below is the current html code: <div class="col-xs-12 col-md-6 col-lg-4"> ...stuff </div> I am wondering how to achieve the following transformation: index ...