Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center input in "quasar way"

I started using quasar and I would like to have input centered but in a quasar way (using quasar available classes, components and directives). I do not want to force style with !important. Here is codepen https://codepen.io/luckylooke11/pen/RwwqJex

<div id="q-app">
  <q-layout>
    <q-page-container>
    <q-page class="home-page q-gutter-lg">
    <div class="row justify-center q-pa-md">
      <div class="col-auto">
        <img alt="My image" class="image" src="../assets/images/image.png" />
      </div>
      <div class="col-12 text-center self-center">
        <h2>My gooogle search</h2>
        <q-input outlined square v-model="text" class="input self-center" placeholder="my centered input">
          <template v-slot:append>

            <q-icon v-if="text !== ''" name="close" @click="text = ''" class="cursor-pointer"></q-icon>
            <q-icon v-else name="search"></q-icon>
          </template>
        </q-input>
      </div>
    </div>
  </q-page>
    </q-page-container>
    </q-layout>
</div>

Thank you for any hint.

like image 903
Luckylooke Avatar asked Oct 26 '25 09:10

Luckylooke


1 Answers

Apply this classes to q-page and remove your input class: window-height window-width row justify-center items-center

row sets the display property to flex, justify-center centers it horizontally and items-center centers it vertically.

Please refer this codepen.

https://codepen.io/Pratik__007/pen/oNNQMJP?editors=1010

like image 50
Patel Pratik Avatar answered Oct 29 '25 08:10

Patel Pratik