Vertical alignment using Bootstrap buttons for pull-up and pull-down functionality

My design includes a row of Bootstrap buttons displayed horizontally. These buttons come in two sizes - medium and small, with the requirement that two small buttons should occupy the same vertical space as one medium button when stacked vertically.

To illustrate, here is an example of a medium button:


      <a class="btn btn-lg top-buffer align-root half-width double-height btn-primary " id="WID020" href="#"> 
        <div id="EL034">
            <h6 class="align-bottom-left text-default ">MD. BTN</h6>
        </div>
        <div id="EL033">
            <i class="fa align-center-center fa-car fa-2x text-default"></i>
        </div>
      </a>

Conversely, here are two small buttons placed within a btn-group-vertical:


     <div class="btn-group-vertical ">
        <div>
          <a class="btn btn-lg top-buffer align-root quarter-width btn-danger" style="vertical-align: top; display: table-cell;" id="WID021" href="#"> 
            <div id="EL040"><i class="fa align-center-center fa-volume-up fa-6x text-default"></i></div>
          </a>
        </div>
        <div>
          <a class="btn btn-lg top-buffer align-root quarter-width btn-warning" style="vertical-align: bottom; display: table-cell; position:relative;" id="WID021" href="#"> 
            <div id="EL040"><i class="fa align-center-center fa-volume-down fa-6x text-default"></i></div>
          </a>
        </div>
     </div>

While I was able to align the top small button using

style="vertical-align: top; display:table-cell;"
, achieving the same alignment for the bottom button proved to be more challenging.

If anyone has suggestions on how to resolve this while staying within the confines of Bootstrap/CSS, possibly utilizing flexbox, it would be greatly appreciated!

For reference, here's a demo on Bootply: bootply demo

The specific issue pertains to the orange button: https://i.sstatic.net/I7nH7.jpg

Answer №1

During my test, the spacing appeared to be working correctly, so it seems like this issue may be specific to certain browsers; I primarily tested on Chrome version 61.0.3163.79.

If the browser is not the root cause of the problem, it could be worth considering removing the btn-group-vertical class as it might be causing conflicts with individual alignments.

Additionally, for users utilizing Bootstrap 4 (unfortunately, I don't have access to it for confirmation), there are some new vertical alignment classes available which could potentially resolve alignment issues. You can check out this resource for more information.

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

Navigating the page by utilizing Javascript through a CSS selector

I am encountering a small issue with scrolling a pop-up window. I am trying to scroll a popup that contains a div and some CSS code without using an ID or class. Here is the HTML CSS Code snippet: <div style="height: 356px; overflow: hidden auto;"> ...

I am encountering an issue with the navigation bar and container layout in Bootstrap

I'm new to utilizing bootstrap and currently, I'm working on creating a navigation bar. Here is the code that I have written: <nav class="row navbar navbar-expand-lg navbar-light bg-white"> <a href="#&q ...

Three divs aligned horizontally

Can anyone help me create a layout with a left menu, right menu, and a middle section with page content arranged like this example: I am attempting to build this layout using Bootstrap 4 for responsive design, but I am struggling to get all three menus to ...

The border line beside the text in the current tab remains unchanged

I want to display a border line next to a tab when it is clicked or active. Currently, I am only able to show the line next to the tab that was initially selected, but it does not change dynamically with other tabs. Here is my current implementation: $(d ...

Is there a way to condense the row navigation links into a dropdown menu button if the browser window size decreases?

I've noticed that on many websites, when you narrow the width of the browser window, the row of navigation links in the top navigation bar collapses into a dropdown menu button to prevent overflow. How can I implement this feature on my website? Righ ...

How to keep the Bootstrap column in place while making it fixed

I'm struggling to make the second column (yellow part) stay fixed in position. I've tried using CSS position:fixed, but the column keeps shifting to the left. <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/cs ...

Tips for making modal body text reactive to different screen sizes

The text sent from JavaScript to the modal does not make the text_description element in the modal body responsive Modal Image https://i.sstatic.net/UJEG8.png HTML Code Snippet <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/boot ...

What is the optimal HTML tag for showcasing chat text conversations?

To create a text window with fixed width and length that automatically wraps long texts without a horizontal scroll bar but with a vertical one, you can use HTML and CSS. The preview window on SO's ask question page is a good example of this. It is si ...

Leverage the power of Bootstrap by showcasing several carousels in a sleek grid layout

How can I display dynamically generated carousels in a grid format using Bootstrap4? Current formation: https://i.sstatic.net/H3du7.png I want to showcase multiple carousels containing one or more images in a clean grid layout instead of the current hor ...

What is the process for applying CSS styles to a particular component?

What is the recommended way to apply CSS styles to a specific component? For instance, in my App.js file, I have added Login and Register components for routing purposes. In Login.css, I have defined some CSS styles and then imported it into Login.js. T ...

Exploring the div's classes using SCSS

I recently started learning SCSS. I apologize if this question has been asked before, but I couldn't find the exact solution I was looking for. In one of my .erb views, classes are dynamically assigned to a specific div. Here's an example: < ...

Having trouble getting text to align vertically in Bootstrap CSS?

I'm currently working on creating a horizontal counter to indicate the step in progress. We are using bootstrap 4 for this project. The CSS is functioning correctly without bootstrap, but once it is added to the project, it's not aligning vertica ...

Is it appropriate in responsive design to use multiple markups for the same page elements?

Currently, I am in the process of coding a responsive design that will feature various navigation layouts depending on the screen resolution. Unfortunately, I don't have the authority to make design decisions in my workplace. While working on this pr ...

Elements that are added dynamically do not contain any space between each other

I have a markup template that looks like this. <template id="unsequenced-template"> <button type="button" class="btn btn-primary railcar"></button> </template> Then, I use the following JavaScript ...

"Using Flexbox to Align Child Elements of Varying

After learning about flexbox, a pressing question arose: How can I create a layout of columns similar to the one shown in this image? Check out MyCodeFiddle for more details! (http://jsfiddle.net/1s3bo913/) Click here to view the layout project: Layout Pr ...

Exploring the Collapse and Dropdown features in Bootstrap 5 Navbar

Struggling with my navbar on Bootstrap 5 - the collapse feature isn't working after expanding, and the dropdown list fails to drop down. <!-- Using Bootstrap-5 --> <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-pro ...

Issues with concealing the side menu bar in Vue.js

I've been attempting to conceal the side menu bar, with the exception of the hamburger icon when in the "expanded" state. Despite my efforts to modify the CSS code, I am still struggling to hide the small side menu bar. The following images represent ...

css element remains stationary and in view

Issue at hand: I have created a logo file named .art-obj1631017189 and I am looking to fix its position. It appears to work fine, but when scrolling down and it encounters the content section, my object falls behind the content (item-layout). I desire to ...

Is it possible to utilize the ternary operator to handle classnames when working with CSS modules?

I am experiencing difficulty implementing a styling feature using the ternary operator within an element's className. My goal is to have three buttons that render a specific component when clicked. Additionally, I want to change the background color ...

Achieving proper form alignment through Bootstrap

Is there a way to create a form that looks like the one shown in the picture, where regardless of the length of the variable names (Name, Mobile, Gender, Age), all value receiving blocks are the same size and aligned vertically? My initial approach involv ...