Arrange the two buttons in a vertical position

Excuse any weak code you may come across, as I am a backend developer.

This is the current appearance of my form:

The alignment of these two buttons in Chrome is not correct

The issue only occurs in Chrome, with FireFox and Edge displaying the form as expected. For reference, here is how I want the form to look (screenshot from FF):

Desired form layout (from FF)

The HTML code for the Form:

<div style="margin-top: 20px;margin-left: 100px;">
        <div class="card card-outlined style-primary-dark" style="width: 80%">
            <div class="card-head">
                <header><i class="fa fa-fw fa-lock"></i> QR Code</header>
            </div><!--end .card-head -->
            <div class="card-body">

                <form class="form-horizontal" role="form">

                    <div class="form-group">
                        <label for="txtData" style="color:#0d998f;" class="col-sm-2 control-label">Texte à Crypté</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="txtData" placeholder="Saisir vos données...." required>
                        </div><br><br><br>
                        <div class="col-sm-10 navigator">
                            <button id="btGenerer" type="button" class="btn ink-reaction btn-primary">Générer</button>
                            <button id="btSaveQR" type="button" class="btn ink-reaction btn-default-dark">Sauvegarder</button>
                        </div>

                    </div>

                </form>
            </div><!--end .card-body -->
        </div><!--end .card -->
    </div><!--end .col -->

Here is some CSS specific to FireFox and Edge:

@-moz-document url-prefix()
    {
        .navigator {
            margin-left:37%;
        }
    }

    @supports (-ms-ime-align: auto) {
        .navigator {
            margin-left:37%;
        }
    }

When inspecting the page on Chrome, it appears that the "Générer" button takes up a lot of space which might be causing the alignment issue. See image below:

Générer Button

Sauvegarder Button

Answer №1

To update the styling and remove browser-specific CSS, simply add the following CSS:

.navigator{
  text-align: center;
}
.navigator button{
  display: inline-block;
  padding: 8px 15px;
  border: 0;
  box-shadow: none;
  outline: none;
  background: #20252b;
  color: #fff;
  cursor: pointer;
}
button#btGenerer{
  background: #0aa89e;
}
<div style="margin-top: 20px;margin-left: 100px;">
        <div class="card card-outlined style-primary-dark" style="width: 80%">
            <div class="card-head">
                <header><i class="fa fa-fw fa-lock"></i> QR Code</header>
            </div><!--end .card-head -->
            <div class="card-body">

                <form class="form-horizontal" role="form">

                    <div class="form-group">
                        <label for="txtData" style="color:#0d998f;" class="col-sm-2 control-label">Text to Encrypt</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id="txtData" placeholder="Enter your data...." required>
                        </div><br><br><br>
                        <div class="col-sm-10 navigator">
                            <button id="btGenerer" type="button" class="btn ink-reaction btn-primary">Generate</button>
                            <button id="btSaveQR" type="button" class="btn ink-reaction btn-default-dark">Save</button>
                        </div>

                    </div>

                </form>
            </div><!--end .card-body -->
        </div><!--end .card -->
    </div><!--end .col -->

For a live example, you can visit this fiddle here

Answer №2

To achieve alignment, consider implementing flexbox. It can assist in both vertical and horizontal positioning of elements.

.navigator{
  display:flex; 
  align-items:center; 
  justify-content:center;
}

See a demonstration here: https://jsfiddle.net/odecLzad/

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

Unexplainable space or padding issue detected in OwlCarousel grid gallery

There seems to be an unusual gap or margin at the bottom of each row section in this portfolio grid gallery that's running in OwlCarousel. You can view an example here. https://i.stack.imgur.com/NHOBd.png I've spent a lot of time trying to solv ...

What is the best way to align HTML elements in a single row?

I have the following code snippet... <div class="header"> <div class="mainh"> <div class="table"> <ul> <li><a>smth</a></li> ...

"Enhance your website navigation with the Bootstrap BS3 navbar clc Dropdown-Submenu feature

Utilizing Bootstrap BS3 for the construction of my Django website. I created a dropdown-submenu that is operational on http://www.bootply.com/nZaxpxfiXz# https://i.sstatic.net/85uTq.png However, when implementing the same in my project, I encountered: h ...

Tips for preserving checkbox state?

I am currently working on a web application project for a clinic and laboratory, specifically focusing on sending tests. I have implemented the code below to select the test category first, followed by the test name related to that category. However, when ...

Having trouble with vendor CSS not being recognized during brunch compilation

I am currently exploring the use of Pure.css in my application. After installing it via npm, I have configured my brunch-config.js as follows: stylesheets: { joinTo: { 'app.css': /^app/, 'vendor.css': /^(?!app)/ } } At thi ...

When buttons are clicked within Angular Material's Card component, it automatically triggers the click event of the card itself

One of the challenges I'm facing is having a mat-card within a component template: <mat-card *ngFor="let p of products" (click)="viewProduct(p)"> <mat-card-actions> <button mat-stroked-button (click)="addProductToCart(p)"&g ...

The Bootstrap toggler is failing to conceal

Currently, I am working on a website utilizing Bootstrap 5. The issue arises with the navbar - it successfully displays the navigation when in a responsive viewport and the toggler icon is clicked. However, upon clicking the toggler icon again, the navigat ...

Updating the div#content dynamically with Jquery without the need to refresh the page

After spending countless hours on this forum, I have yet to find a solution that perfectly fits my needs, so I will pose my question. Here is the gist of what I am attempting to accomplish: When the page loads, the default page fades in and displays. Wh ...

Applying identical values to multiple properties (CSS)

Can we assign a single value to multiple CSS properties at once? border-left, border-right: 1px solid #E2E2E2; Similar to how we can with selectors? .wrapper, .maindiv { ... } ...

Scaling the ion-spinner to fit your specific needs

In my Ionic application, I am utilizing the ion-spinner. However, I have encountered an issue with resizing the spinner. While custom CSS works well with default spinners, it does not function properly with Bubbles, Circles, and Dots spinners. CSS .spin ...

My component reference seems to have gone missing in angular2

Trying to load my Angular 2 app, I encountered this error: https://i.stack.imgur.com/FmgZE.png Despite having all the necessary files in place. https://i.stack.imgur.com/kj9cP.png Any suggestions on how to resolve this issue? Here is a snippet from ap ...

Uploading images using the Drag and Drop feature in HTML

Hello, I'm having an issue with the drag and drop functionality. I want to expand the size of the input to cover the entire parent div, but for some reason, the input is appearing below the drag and drop div. Can anyone assist me with this? https://i. ...

Innovative CSS trick for styling checkboxes alongside non-related content

The CSS checkbox hack demonstrated below assumes that the content is a sibling of the checkbox. By clicking on the label, the content will toggle. Check out the DEMO here <input id="checkbox" type="checkbox" /> <label for="checkbox"> Toggle ...

The form yields no response and fails to send any data

Ensuring that the form on this site successfully sends the name and phone number is crucial. However, upon clicking the send button, I encounter an empty modal window instead of a response indicating whether the data was sent or not. The contents of the fi ...

Using Cascading Style Sheets (CSS) to make posts appear above an image in a scrolling format

Can anyone guide me on how to show the text above an image contained within a scroll bar, similar to the picture below? Despite trying position property and searching online, I haven't found a solution yet. Your help would be greatly appreciated. ...

Updating the content with HTML and JavaScript

Hello everyone, I am currently working on a project to change the content of a div using JavaScript for educational purposes. Here is what I have done so far - <div id="navbar"> ... <ul> <li> <text onclick="getWordProcessing() ...

Flipping a combination of CSS 3 and JavaScript cards will cause them to flip all together in unison

Hello! I came across a really cool card flip code that is IE compatible. I made some modifications to it and got it working, but there's one problem - instead of flipping the selected card, it flips all the cards. I tried modifying the JavaScript code ...

Troubleshooting problem with sorting in Angular 4 material header

Using Angular 4 material for a table has presented me with two issues: 1. When sorting a table, it displays the description of the sorting order in the header. I would like to remove this. https://i.sstatic.net/5bHFO.png It displays "Sorted by ascending o ...

Tips for formatting angular text sections

Within the scope of a controller, I have a status variable. After a successful rest PUT request, I add a message to this JavaScript variable. This message is displayed in my template using the {{status}} Is there a way to customize the styling of this mes ...

Adding content to a text field and then moving to the next line

I am looking to add a string to a text area, followed by a new line. After conducting some research, here are the methods I have attempted so far but without success: function appendString(str){ document.getElementById('output').value += st ...