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. https://i.sstatic.net/wSFBP.png

Something like this: https://i.sstatic.net/rfqAB.png

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

What is the best way to ensure the header spans the entire width of a webpage using the display: flex; property and flex-direction: column styling within the body element

Click here for the CSS code snippet Hello everyone, this is my very first query on Stack Overflow. I know it might be a simple question but it's my first time posting here so kindly bear with me. Below is the CSS code snippet provided: *{ ...

Guide to finding the parent component of a particular element?

When the add button is clicked, I am dynamically adding lists and a new button labeled as "New Button" to a web page. My goal is to have a variable printed inside the parent list when this "New Button" is clicked. How can I achieve this functionality? Bel ...

What is the best way to center the text in the middle of a flex container?

I am struggling with the alignment of elements in my code. Here is what I currently have: HTML: </div class="container"> <footer>Maximilian Crosby ©</footer> </div> <div class="bot-bar" > <a href="./contact-u ...

Using Bootstrap to Position DIVs at the Top, Middle, and Bottom

I'm looking to create a layout with three DIVs inside a container DIV, all centered horizontally. The first DIV should be aligned at the top of the container, the second in the vertical center, and the third at the bottom. While I found some helpful t ...

Valid ways to ensure that a CSS image expands outside the boundaries of the containing div

I have inserted an image using the following CSS code: .imgtemp { float:right; top:0px; left:0px; overflow:visible; width:100%; } Although I have added the div tag to display it on the page, ...

Is the hover effect malfunctioning, even though the correct style has been applied?

I'm currently working on a simple design, but I've encountered an issue. When I hover over the number blocks (1, 2, etc.), my hover effect doesn't seem to work. My intention is to hover over the list item and change the entire digit text fro ...

Enable scrolling for a div positioned beneath another div

I am working with an iPad frame and trying to implement a feature where a larger image scrolls behind it as the user scrolls down the page. Although my CSS is more complex than the example provided in this link, I am struggling to get even that basic funct ...

What is the best way to create a seamless background transition for buttons on a mobile device?

Currently, I am working on my random quote generator project and I am trying to make it so that when the button is touched on a mobile device, the background color becomes semi-transparent. Below is the code I am using: #loadQuote { position: fixed; w ...

What is the best way to generate a variable amount of div elements with constantly changing content using Angular2?

I'm not entirely sure on the process, but I believe ngFor would be used in this scenario. Essentially, my goal is to generate the following div multiple times, with each iteration updating the value inside the brackets from 0 to 1, 2, and so forth... ...

"Error: The property $notify is not found in the type" - Unable to utilize an npm package in Vue application

Currently integrating this npm package for notification functionalities in my Vue application. Despite following the setup instructions and adding necessary implementations in the main.ts, encountering an error message when attempting to utilize its featur ...

Troubleshooting the problem of fast rotation and scrolling of text in the middle but slow movement at the end with

Currently, I am utilizing the jquery animate function for animating text while also aiming to rotate the text if a specific degree is passed. In order to achieve this, I have implemented the following code snippet: var leftCss = "-"+$('#mydiv'). ...

How can I give an HTML form input button the appearance of glowing or lighting up like the default OS style?

Is it possible to make the <li><FORM><INPUT class="eButton" type="button" value="Ole"></FORM></li> class glow or light up to notify the user about something, while maintaining the default OS look on Linux, Mac, and Windows? F ...

Creating a visually stunning image grid akin to the meticulously designed layouts found

Forgive my lack of knowledge, but I'm curious about how to create an image or text grid similar to Tumblr using HTML and CSS. I'm looking to achieve a layout like this: ...

Ways to display a vertical scrollbar within a select box

I'm currently working with an Angular select box and I'm looking to display a scroll bar if there are more than 5 data entries. <select class="form-control" data-ng-model='projectListData.appVersion' ng-selected ng-options="v.versio ...

Dynamic Image Grid Created Using JavaScript Glitches

My dilemma involves using JQuery to create an HTML grid of images styled with Flex Boxes. The setup works perfectly on desktop, but when viewing it on mobile devices, the images begin to act strangely - jumping, overlapping, and even repeating themselves i ...

Sending data through props to components that can only be accessed through specific routes

File for Router Configuration import DomainAction from './components/domainaction/DomainAction.vue' ... { path: '/domainaction' , component: DomainAction }, ... Linking to Routes using Router Links ... <router-link to="/domainact ...

Steps to Customize the Icon of a Vuetify Autocomplete Component

Vuetify autocomplete typically comes with custom "up" and "down" arrow icons: https://i.stack.imgur.com/xhW2x.png https://i.stack.imgur.com/9F8i3.png Is there a way to replace these icons with a search icon for different events (active or inactive) in or ...

Implementing a dual hover effect on a Div element

I am working with HTML code that includes an image and text <div class="subcontainer1"> <img src="a.png" alt="" class="imgcolumn"> <h3 class="header3">Hello</h3> </div> This setup places the content above the image. ...

Issue with highlighting when one string overlaps with another

I am facing a challenge with handling a string that contains Lorem Ipsum text. I have JSON data that specifies the start and end offsets of certain sections within the text that I need to highlight. The approach I am currently using involves sorting the JS ...

Can a vertical line be sketched next to a horizontal line?

Let's keep it short and sweet. Here's what I'm attempting to achieve: Currently, this is what I have: Below is the code snippet: #ligne_horizontale_experience { margin-left: 50px; width:170px; height:400px; border ...