question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Help] How to center items in v-container's horizon and vertical view

See original GitHub issue

Steps to reproduce

  1. I use below code to layout my whole page content:
<div id="app">
  <v-app id="inspire">
    <!-- -->
    <v-toolbar fixed :dense="true" class="primary" :dark="true" scroll-off-screen scroll-target="#scrolling-main">
      <!-- <v-toolbar-side-icon @click.stop="drawer = !drawer"></v-toolbar-side-icon> -->
      <v-toolbar-title>xxxx</v-toolbar-title>
      <v-spacer></v-spacer>
      <v-text-field prepend-icon="search" hide-details single-line></v-text-field>
      <v-toolbar-items class="hidden-sm-and-down">
        <v-btn to="/">Home</v-btn>
      </v-toolbar-items>
      <v-toolbar-items class="hidden-sm-and-down">
        <v-btn to="/about">About</v-btn>
      </v-toolbar-items>

    </v-toolbar>
    <main id="scrolling-main">
      <v-container class="text-xs-center" style="min-height: 100vh">
        <!--vue-router-->
        <v-layout row child-flex justify-center align-center wrap>
          <v-flex fill-height>
            <v-btn>test
              </>
          </v-flex>
        </v-layout>
      </v-container>
    </main>
  </v-app>
</div>
  1. You can see v-btn is located in the first row ,not in the center of v-layout. what my purpose is to center all the items in v-layout in vertical view . had tried fill-height but no affect .
  2. Please help see the provided link let me know if i need to add some other custom styles

Versions

Latest Vue 2.4.2 Latest Vuetify 0.14.11

What is expected ?

  1. Use the fill-height it should center to the v-container

What is actually happening ?

  1. Try any properties i had found, but still it not located in the center view.

Reproduction Link

https://codepen.io/alterhu2020/pen/GvQqrZ

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

20reactions
nekosaurcommented, Aug 18, 2017

This is one way you can do it. https://codepen.io/nekosaur/pen/MvQjgL

19reactions
despritcommented, Mar 22, 2018

Am I wrong or solution proposed by @nekosaur really isn’t centering element up vertically? Only horizontally.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS: centering things - W3C
Centering vertically and horizontally in CSS level 3 ... We can extend both methods to center horizontally and vertically at the same time....
Read more >
How to Center an Image Vertically and Horizontally with CSS
The third way to center an image horizontally is by using display: flex . Just like we used the text-align property for a...
Read more >
15 ways to implement vertical alignment with CSS
Learn 15 ways to implement vertical alignment for text with CSS, such as explicit grid row placement and pseudo-elements on flex containers.
Read more >
CSS Grid center vertical and horizontal [2022 Tutorial]
Guide to teach you how to center an HTML element horizontally and vertically using CSS Grid.
Read more >
Flexbox: center horizontally and vertically - Stack Overflow
If you want the .row to be centered vertically in the view port, assign 100% height to html and body , and also...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found