What's the best way to ensure that the button stays on the right side of the Bootstrap 4 card header, no matter the device or

Here is my code for a refresh button in the header of a Bootstrap 4 card:

<div class="animated fadeIn">
    <div class="row">
        <div class="col-lg-12">
          <div class="card">
            <div class="card-header">              
              <div class="row">
                <div class="col-6 col-sm-4 col-md-2 col-xl mb-3 mb-xl-0">                   
                    <button type="button" class="btn btn-success mr-1" data-toggle="modal" (click)="refresh()">
                      <i class="fa fa-align-justify"></i>
                      </button>
                </div>
              </div>    
            </div>
            <div class="card-body">

                <!-- other markup -->
            </div>
        </div> <!-- ./ card -->
        </div> <!-- ./ col-lg-12 -->
    </div> <!-- ./ row -->
</div> <!-- ./ animated fadeIn --> 

However, I am facing an issue where the button remains on the left side both on desktop and mobile view. I need help with making this button stay on the right side at all times, supporting Chrome, Firefox, and Edge.

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

Answer №1

You have multiple solutions to address this problem, but here are two examples that I have provided for you:

"layout": Utilizing one flex wrapper (outlined in orange) with two columns inside (outlined in red)

A. justify-content-between

To achieve this layout, use flexbox and apply the justify-content-between property

B. Flex and margin-left auto col

Create a flex wrapper and set the left margin of the icon column to auto:


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

Using :before and :after in CSS, three dots can be created in a horizontal line

I am currently trying to display three horizontal dots on my webpage. I have created a demonstration on jsfiddle. span { position: relative; background-color: blue; border-radius: 5px; font-size: 0; margin-left: 20px; padding: 5px; ...

Is it possible to modify the background color of the firefox address bar according to the type of protocol being used?

Is there a way to customize the background color of the address bar in Firefox according to different protocols? For example, using blue for https, orange for mixed content warning, green for ev-certificate, and red for invalid certificates. ...

What causes Safari to display a black border around resized videos?

I've come across a strange issue while using Safari. Whenever I try to play an MP4 video with dimensions of 1920 * 1080, and resize the Safari window to a width of 937px, something strange happens: https://i.stack.imgur.com/oI50i.png A black border ...

Make the most of your Bootstrap 3 layout by utilizing a full page container that fills both the width and height between a fixed header and

I am currently working on a basic bootstrap page with the Example template from Bootstrap's website. I want the content in the middle to take up the space between the header and footer, while ensuring that both the header and footer remain visible at ...

Display the table upon completion of the form submission

I am trying to create a form where the table #mytable is only displayed after the form has been submitted. If nothing is entered in the form, the table should remain hidden. Any suggestions on how I can achieve this? <form action="" id="myform" method ...

Shift the <tfoot> table to the right using CSS

Is there a way to shift the red area (x1, x2) to the right using only CSS in a table where the <tfoot> tag cannot be edited? https://jsfiddle.net/qL03728p/ table { width: 100%; border-collapse: separate; } table td { border-top: 1px solid ...

Troubleshooting Bootstrap's Margin Problem

Currently, I am delving into the basics of bootstrap and encountering some challenges with using margin-auto. Specifically, I am working on positioning a navbar by using ml-auto to separate it from the brand, pushing the navbar to the right side of the p ...

Stylish CSS round link positioned on a half-circle

As a beginner in web design, I'm struggling with CSS. However, I have been given the task of creating a button like the one shown below. I am unsure of how to create a circular link like this. Any assistance would be greatly appreciated. ...

The click event is activated following the :active selector being triggered

My Angular application features a button with a slight animation - it moves down by a few pixels when clicked on: &:active { margin: 15px 0 0 0; } The button also has a (click)="myFunction()" event listener attached to it. A common issue arises w ...

Arrange elements within a division when the division splits into two rows

Currently in my setup: I have a navigation bar with a group of buttons located on the right-hand side. When the navbar is reduced to a smaller size, like on a smartphone, the two buttons get split across 2 rows within the div. In this state, I'm ai ...

Adjusting the dimensions of a button: What to expect

I'm currently working on a toggle switch that I want to make responsive for future resizing. The toggle switch includes a red square (for demonstration purposes), but I've encountered an issue where the red square stretches and changes its dimens ...

Creating CSS wrappers around div elements of varying sizes

I am looking for a way to "wrap" different divs of varying sizes, similar to how Microsoft Word wraps text around an image. I have a simplified structure outlined below: <div id = "div1"></div> <div id = "div2"></div> <div id = ...

Changing the CSS Border of Thumbnails

Take a look at this screenshot of a thumbnail grid. I need to reposition the gray border so that it sits below the price and is consistently aligned across all products. The challenge arises when product titles vary in length, causing the price to be posit ...

ExtJS web displays appear differently when viewed on Chrome's toggle device mode versus a mobile browser

Greetings, I have been working on developing a web application that can be accessed through a mobile browser. Initially, I created the web application and tested it in mobile mode using Chrome's simulation feature. https://i.sstatic.net/aAvVW.jpg H ...

Styling Vue JS Components with CSS Binding

I've been trying to apply CSS styling to vuejs tags without success. I'm struggling to get it to work with both regular styling and conditional binding. I've exhausted all the solutions on stackoverflow, but nothing seems to be working for m ...

How can I properly save a PNG image with alpha transparency to be compatible with IE6?

Seeking advice on saving a visually pleasing 1 or 8-bit PNG image that renders well in IE6. Open to suggestions on alternative methods as I have experience with Fireworks but exploring new options. Thank you in advance! ...

Concealing a hyperlink depending on the value chosen in a dropdown menu

Looking for guidance on how to use jQuery to read the current value of a drop-down list and hide a specific link based on that value. The drop-down list is for selecting the language/locale. For example, when "English" is selected, I want the link to be h ...

Is there a way to collapse an element by clicking either the content inside the div or the button within the div?

Is there a way to make a button within a newly activated div close it? The existing code seems to have issues with this functionality, and adding new rules or functions has not solved the problem. Any assistance with fixing this issue using vanilla JavaScr ...

Uniform selection frame width across nested list elements

I want to ensure that the width of the selection frame for all nested ul li elements is consistent, just like in this example. When hovering over an element (making the entire line clickable), I don't want any space on the left. Currently, I am using ...

I'm noticing that the top border for my span is smaller than the bottom one. What could

I am struggling to create an arrangement of three triangles in a line, with the first and third pointing up and the middle one pointing down. The upper triangle seems to be too small - any ideas on how to adjust this? Is there another way to achieve this ...