Tips for aligning a cluster of floating buttons at the center in Vuetify:

This is the code I am currently working with:

<v-container height="0">
    
  <v-row align="center" justify="center">
    <v-hover v-slot:default="{ hover }" v-for="(option, index) in options" :key="index">
      <v-tooltip top color="transparent">
        <template v-slot:activator="{ on, attrs }">
          <v-btn
            v-bind="attrs"
            v-on="on"
            color="white"
            fab
            dark
            medium
            absolute
            bottom
            left
            @click="OptionSelected(option)"
            :style="{ marginBottom: '120px', marginLeft: 10 + 65*(index) + 'px', marginRight: 10 + 65*(index) + 'px'}"
          >
            <v-img
              height="55"
              width="40"
              style="object-fit: contain; border-radius: 50%"
              :src="option.thumbnail"
            >
            </v-img>
            <v-expand-transition>
              <div
                v-if="hover || option.selected"
                class="d-flex amber v-card--reveal body-1"
                style="border-radius: 50%;"
              >
              </div>
            </v-expand-transition>
          </v-btn> 
        </template>
        <div style="margin-bottom: 100px; background-color: white; color: black; padding: 10px; border: 2px solid grey; border-radius: 5px">
          {{ option.title }}
        </div>
      </v-tooltip>
    </v-hover>
  </v-row>
  .......
  </v-container>

I have a series of floating buttons that I need to horizontally center. Despite trying various methods like

style="left: 50%; transform: translateX(-50%)"
, I haven't been successful in achieving this alignment. Can someone assist me in accomplishing this?

Here is my updated code with additional tooltips and hover elements integrated.

Answer №1

Place the <v-btn> components within a <v-row> element, ensuring to set its justify and align properties to center:

const vm = new Vue({
  el: '#app',
  vuetify: new Vuetify(),
})
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c1a19092c5e425a425d5e">[email protected]</a>"></script>
<script src="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9debe8f8e9f4fbe4ddafb3aeb3aca8">[email protected]</a>/dist/vuetify.js"></script>
<link rel="stylesheet" href="https://unpkg.com/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="83f5f6e6f7eae5fac3b1adb0adb2b6">[email protected]</a>/dist/vuetify.min.css">

<v-app id="app">
  <v-container class="grey lighten-5 mb-6" >
    <v-row align="center" justify="center">
      <v-btn
             fab
             dark
             medium
             v-for="index in 3"
             >
        {{index}}
      </v-btn>
    </v-row>
  </v-container>
</v-app>

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

Adjusting the spacing between the logo and navbar in HTML code

I am struggling to understand why this issue keeps occurring: I have thoroughly checked for errors, attempted multiple solutions, yet the problem persists. Please assist body { margin: 0; padding: 0; } .logo { margin: 0; padding: 0; } ul { li ...

Ways to clear dropdown selection in Vue based on a specific condition?

I am currently developing a dropdown menu for selecting visit status options, which include "pending," "canceled," "rejected," and "approved." In the case of an approved visit status, I would like the dropdown selection to only display the options for "can ...

Troubleshooting Angular JS loading problems

I'm attempting to implement the Angular-Spinner in my project: Specifically, I want to use it with http.get calls. This is what I have so far: Within controllers: $scope.loading = true; $http.get('js/data/test.json').success(function(resu ...

Displaying text on hover and showing a text box when a link is clicked using CSS and JavaScript

Hovering over the text will display "Edit," and clicking on it will reveal a text box. This function will be used to update content using ajax. HTML: <table> <thead> <tr> <th> Name </th> <th> Age </th> ...

Executing a C# function from an HTML hyperlink

I am in the process of developing a website using ASP.NET C#. The site will feature a GridView with data that can be exported, such as to Excel or other formats. To handle the export functionality, I plan to utilize code from this resource. When a user c ...

The Angular 7 template falls short of occupying the entire page

I am currently working on converting an HTML page into my Angular project. While it functions correctly in the HTML version, it does not fill up the entire page when transferred to Angular. You can view an example of this issue on StackBlitz at the followi ...

Include parameters for a pagination system

I have a script that fetches data from my database and generates pagination. Everything is working fine, but now I want to include a conditional statement to differentiate the user level as New, Current, or Renewing client. I've already set up some s ...

Tips for customizing the border radius style of the menu in Vuetify's v-autocomplete component

I am looking to customize the appearance of the drop-down list in the v-autocomplete component by adding a border-radius style, as depicted in the image below. The current design I have achieved closely resembles the visual shown below. Previously, I app ...

What is the process for integrating three.js code manually into an iframe?

I recently posted a question on Stack Overflow inquiring about how to input code into an iframe without using a file or URL. While I was successful with simple cases like <h1>Hello World</h1>, my ultimate goal is to integrate three.js into thes ...

Is the "position: sticky" feature functioning correctly, or is there a slight vibrating or dancing effect when users scroll through the Ionic app? How can we eliminate this issue specifically on iOS

Looking for suggestions on this problem - the position sticky is functioning correctly, but there seems to be a slight vibration or dancing effect when users scroll in the Ionic app. Any ideas on how to eliminate this issue specifically on iOS devices? & ...

The beautiful synergy between Vuetify's v-input component and overflow animation

I am having trouble implementing an overflow animation on vuetify's v-text-field component. Despite my efforts, I can't seem to make it work as intended: <script setup> const text = 'very long long long long long text' </scri ...

When combining <a> with the class line-through, the line does not appear

I am currently utilizing a class to replace the deprecated strike in HTML: .entfall { text-decoration: line-through; } However, when using Firefox 38.x and the following code: <span class="entfall"><a href="some link">text</a></span ...

Tips for avoiding the automatic transition to the next slide in SwiperJS

How can I prevent the next button click in swiper based on my custom logic? I am using the swiperjs library within a Vue project and I need to stop users from swiping or clicking the next button to move to the next slide depending on certain conditions de ...

Adjust the size of my navigation bar to match the dimensions of the browser

I'm currently facing an issue with my website's navigation menu on mobile devices. I've been attempting various solutions to make the navigator scale up appropriately with the browser, but so far nothing seems to be working. Below is the HT ...

What is the process for enabling SASS line numbers using Yeoman's Grunt.js file?

Recently, I used Yeoman (1.4.5) to scaffold a new web application. Within my Gruntfile.js, I configured it as follows: ... // When requested, compile Sass to CSS and generate necessary files sass: { options: { lineNumbers:true, sourceMap: true, ...

Python Selenium error: NoSuchElementException - Unable to find the specified element

Coding Journey: With limited coding knowledge, I've attempted to learn through various resources without much success. Now, I'm taking a different approach by working on a project idea directly. The goal is to create a program that interacts wi ...

Transfer the textbox value from page-1 to page-2 seamlessly with the help of AngularJS UI-routing

I'm attempting to transfer the textbox value from Page-1 to Page-2 using the code below, but I am encountering difficulties. Page-1.html <div > <div style="height: 400px"> <h2>Partial view-1</h2> <p> ...

Insert placeholder text without access to the input field

Is it possible to activate a placeholder in a component that is outside of the current context? For example: <foreign-component [config]="someConfig" placeholder="somePlaceholder"></foreign-component> The <foreign-compo ...

At what point does a prop become officially designated as having the same value as what was initially passed to the component

I am experiencing unreliable behavior in my component, where a prop is passed and I need to debug it: <my-component :number="someNumber" /> The number prop is defined in my-component through a standard declaration: prop: ["number" ...

Launching npm start with Vue.js 2 and webpack opens and refreshes in Firefox, not in Chrome

Currently, I am following the Vue.js tutorial "The Ultimate Vue JS 2 Developers Course"(Project 2) and encountering an issue with the browser refresh on file change. I am using Kubuntu 16.04 with Chrome as my system's default browser. However, every t ...