How can I center <text> within a button using Vue Native?

Is there a way to position the "login" text in the center of the button? I've attempted using align-items: center; and justify-content: center;, but it doesn't seem to be working

https://i.sstatic.net/XVHWA.png

  <template>
  <view class="container">
      <view class="inputContainer">
        <text-input v-model.trim="loginObj.memberCode" class="username" placeholder="username"></text-input>
        <text-input v-model.trim="loginObj.password"  class="password" placeholder="password"></text-input>
        <text class="forgotPassword">forgot password?</text>
      </view>
      <view>
        <touchable-opacity class="button" :on-press="login">
          <text class="loginText">login</text>
        </touchable-opacity>
      </view>
  </view>
</template>

css

.container {
  background-color: white;
  margin-top: 250px;
    align-items: center;
}
.button {
  padding: 10px;
  background-color: #0b5376;
  width: 250px;
  height: 50px;
  border-radius: 15;
  margin-top: 20px;
}
.loginText {
  color: white;
  font-weight: bold;
  font-size: 18px;
}

Answer №1

One way to achieve center alignment is by using the following CSS:

text-align: center; 

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

"Enhancing user experience with jQuery hover effects on table

This is an example of the HTML structure: <tr class="row-1 row-first"> <td class="col-1 col-first"> <div class="views-field views-field-field-logo-image"></div> <div class="views-field views-field-field-logo-title"> ...

I find myself struggling to manage my javascript dependencies

Currently, I am utilizing NPM along with various angular packages. As per the tutorial on Basic Grid Part 1 at this link, I am encountering challenges. This is my file directory structure: D:/nodeStuff/uiGrid includes: node_modules uigrid.css uigrid.h ...

Begin your journey with Foundation Navigation as it seamlessly transitions from left to right

I am currently working on this navigation: I am trying to modify the behavior of the hamburger menu so that when it is clicked, it slides from left to right instead of its current downward motion. Additionally, I would like to adjust the width of the menu ...

The use of 'v-on' directives mandates a value or a verb modifier (such as 'stop' or 'prevent')

I made two files, naming them Tasks.vue and Task.vue. From Task.vue, I initiated an action called 'delete-task'. Now, I aim to trigger the same action in Tasks.vue using @delete-task eslint-plugin-vue throws the following error: 'v-on&apo ...

The type 'StoreCallback' does not contain a property named 'getters'

I am trying to set up a store space in quasar, but I am facing an issue where the getter, dispatch, etc. from the store are not recognized. This is my router/store/index.ts file: export const storeKey: InjectionKey<VuexStore<StateInterface>> = ...

As the Div descends, it endeavors to maintain alignment with its counterparts

My webpage has a parent div with multiple child divs in one row. These child divs are generated dynamically, so I don't know how many will be displayed at once. The parent div has a fixed width and a horizontal scrollbar appears when all child divs ar ...

Changing ch to Px in CSS

Important Notes: I have exhaustively explored all the questions and answers related to this particular topic. The question I have is very straightforward: How many pixels are equivalent to 1 character? Here's a sample of my code - code Related Sear ...

"Enhance your data management with Laravel and Vue.js by incorporating the powerful Matfish Vue-Table

Currently, I am utilizing matfish-vue-table2 along with server-side implementation. Below is my Laravel controller where I am able to retrieve the JSON response from the 'api/articles' URL: public function index() { $articles = Article::orde ...

What causes the lack of upward movement for a div element when the div above it is floated to the left?

Recently, I've been delving into the world of float property in CSS. This is the HTML code snippet I'm working with: .left { float: left; text-align: center; width: 25%; } .normal { text-align: center; width: 25%; } <div class="lef ...

When the mouse hovers over the text inside a div, the link does not work in Internet Explorer

Here is some code for demonstration. I'm facing an issue where the link spans over the entire div, which works perfectly in Firefox. However, in IE, when I hover over the text, the cursor changes to a text cursor and the link doesn't work there. ...

Conditionals in ng-class Syntax

I'm attempting to apply a class conditionally to an element, but I'm struggling with the correct syntax. I've experimented with the code below, but it's not functioning as expected: ng-class="{foo: bar === "true"}" The value of bar i ...

Retrieve an image file from Laravel API within Vue Cli 3

I have set up a Laravel API as my backend and Vue Cli 3 for the frontend of my project. I am currently facing an issue trying to access images from storage/app/avatars in Laravel from my Vue front end. To tackle this, I ran the php artisan storage:link com ...

Unable to create a flawless circle using Canvas

No matter how hard I try, drawing a perfect circle seems impossible for me. Every time I attempt it, all I manage to create is an ellipse. Check out this code snippet I put together as an example: function canvasClicked(number) { var c = "canvas" + nu ...

I am attempting to save the input value to an array in local storage using VUEX. However, my current method is not producing the desired results

I am facing an issue where I am trying to push an input value and store it in an array in the local storage using VUEX. I have created an array in the state for this purpose. Initially, I push the value and then I stringify it to set the value to the sto ...

The visibility of overflow-y does not seem to be working properly when overflow-x is

https://i.sstatic.net/hihjC.png .iati-list-table { overflow-x: auto; overflow-y: visible; } When I apply overflow-visible, a scroll bar appears. But when I use overflowy-hidden, the tooltip is cropped. How can I set it so that overflow x is auto a ...

Switch button - reveal/conceal details

I am looking for assistance in toggling the visibility of information when clicking on an arrow icon. I have attempted to use JavaScript, but it was unsuccessful. My goal is to hide the information below by clicking on the downward-facing arrow image , an ...

Ways to emphasize the currently active tabs on a navigation bar

How can I highlight the active tabs and shift it when clicking on another link? $(function() { $('.nav ul li').on('click', function() { $(this).parent().find('li.active').removeClass('active'); $(this).a ...

Ways to optimize memory usage and eliminate Vue reactivity

I've encountered an issue where Vue's observer and reactive components are using up a significant amount of memory during runtime. You can see an example of this in the Memory allocation on DevTools. Is there a way to detach observables and preve ...

Placing an image on a three.js cube using overlay does not function properly

I attempted to superimpose an image onto a cube by utilizing code from GPT chat and Blackbox AI, but in both cases, I encountered a black screen. I saved the code in a file named test.html and tested it on Google Chrome and Opera GX browsers, only to be me ...

Displaying a background image in Laravel using the storage directory

Can anyone offer some guidance on how to load a background image from storage? I have tried using the following code with normal img src, but it doesn't seem to work with background images. background-image: url({{ Storage::get("{$post->image}") } ...