Achieving consistent alignment of titles and buttons across mobile and desktop screens with Bootstrap 5

I am attempting to arrange 1 title and 2 buttons in the following manner:

On mobile : title: centered, one row button1 and button2: full width, stacked on top of each other see image here

Current mobile view: see image here

On desktop: title: right aligned button1 and button2 small

Current desktop view: see image here

I am utilizing bootstrap 5.3 and this is my progress so far:

<div class="container-fluid p-0 m-0">
    <div class="row ">
        <div class="col-6 col-xs-12 ">
            <h2 class="card-title fw-bold">Calendar (<i>not connected to google</i>)</h2>
        </div>

        <div class="col-6 col-xs-12 d-flex justify-content-end">
            <button class="btn btn-flex btn-primary btn-block" data-kt-calendar="connect_to_google">
            <i class="ki-double-arrow-back fs-2"></i>Connect to Google</button>

            <button class="btn btn-flex btn-primary btn-blockt" data-kt-calendar="add">
            <i class="ki-duotone ki-plus fs-2"></i>Add Event</button>
        </div>
    </div>
</div>

Appreciate your assistance.

Answer №1

Give this method a try, it's likely to be successful:

            <div class="container-fluid p-0 m-0">
              <div class="row justify-content-between align-items-center">
                <div class="col-sm-6 d-flex">
                  <h2 class="card-title fw-bold">Calendar (<i>not connected to google</i>)</h2>
                </div>

                <div class="col-sm-6 d-flex flex-column flex-sm-row justify-content-sm-end">
                  <button class="btn btn-flex btn-primary btn-block" data-kt-calendar="connect_to_google">
                    <i class="ki-double-arrow-back fs-2"></i>Connect to Google</button>

                  <button class="btn btn-flex btn-primary btn-blockt" data-kt-calendar="add">
                    <i class="ki-duotone ki-plus fs-2"></i>Add Event</button>
                </div>
              </div>
            </div>

In order to achieve the desired layout, utilize flex-direction row for larger devices and flex-direction: column for smaller ones. Apply this styling to both common rows and columns containing buttons. For rows, employ justify-content-between for horizontal alignment and align-items-center for vertical alignment.

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

Use the localStorage from a Google Map location to set the center of the map in a separate window

In the following template, we have an input field and submit button on a popup: <input type="text" size="50" placeholder="Your adventure is waiting!" id="mapitplace" /> <input type="submit" value="Map It!" id="mapitsubmit"/> Accompanied by t ...

Store data in LocalStorage according to the selected value in the dropdown menu

Can you help me understand how to update the value of a localstorage item based on the selection made in a dropdown menu? <select id="theme" onchange=""> <option value="simple">Simple</option> <option valu ...

I am looking to choose just a single checkbox out of three options and reveal a specific div if one is selected. If none are selected, the div

Whenever I select a checkbox, the corresponding div is being displayed multiple times. Here are the checkboxes available: <INPUT type=CHECKBOX id='IP_3820' IP='12.12.12.12' PORT='5060' onclick='javascript: ipSelected( ...

Looking for assistance with a straightforward CSS opacity fix for Internet Explorer

Take a look at this page comparison between chrome and IE. On the right side, you'll notice drop down fields. While Chrome displays them correctly, IE shows rectangular boxes instead. To fix this issue, I added opacity to the select fields with the ...

The CSS dropdown menu is having trouble showing up correctly

I am struggling with a CSS issue that is really frustrating me. HTML: <div id="nav"> <ul> <li><a href="#">Home</a> <ul> <li><a href="#">More</a></li> ...

Designing a horizontal CSS form with boxes positioned above the text, all done without relying on tables for layout

Do I need to divide everything into divs in order to create a table like the picture I made below? ...

Populating a bootstrap grid with dynamic video content to enhance the visual appeal

I am currently working on a website grid that showcases new announcements and blog posts. In the design, I have a large column (col-sm-8 taking up 2/3 of the page) where I would like to include an introductory video to showcase our work. Despite trying va ...

CSS - enhancing web design with accessible selectors

Hey everyone, I'm really struggling to figure out what's going on with this code. It's a simple CSS issue but for some reason the browser (FF) is completely ignoring the last CSS selection code. Here's the HTML snippet: <div id="c ...

How do I restrict an object from an array in svelte?

I've been scouring the svelte documentation for this information, but it's eluding me. My goal is to display only 4 objects from an array For instance: let data = [ {id:1, name: 'John'}, {id:2, name: 'Peter'}, {i ...

The Bootstrap card becomes compressed when conducting a search within the card grid

After inserting a new image into a card, I noticed that the card gets distorted when I perform a search. I'm unsure if this issue is related to Bootstrap's grid or the image size itself. Any suggestions on how to rectify this would be greatly app ...

Designing HTML Emails Using Nested Tables

Why is my text-decoration="none" not displaying properly? I have tried placing it in various locations like table, tr, td, but I am unable to make it work. Are there any common mistakes when styling email designs? Here is the code snippet: <table cel ...

Is there a way to automatically close the Foundation topbar menu when a link is selected?

On my single page website, I am utilizing Zurb Foundation's fixed topbar which includes anchor links to different sections of the page. My goal is to have the mobile menu close automatically whenever a link inside it is clicked. As it stands now, whe ...

Listening for select elements that have remained unchanged

My current situation involves a select box with predetermined options. One of these options is preselected when the page loads: <select name="select" class="js-choice-select"> <option value="option-1">Option 1</option> <option ...

Problem with spacing in a Bootstrap 5 column of size medium-5

I'm currently working on a template for my website and facing an issue with removing the margin displayed on the right side of my div using flex. I've tried setting the margin to 0 on one of the columns and also experimented with changing the col ...

What is the best method to eliminate white borders on a bootstrap card? Adjusting the border color has proven to be ineffective

<!Doctype html> <html5> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Creative Designs Hub</title> <link rel="sty ...

What are the steps for transitioning from an HTML-table layout solution to a floating-div solution?

Whenever I need to display a list of items with differently sized images on the left and corresponding text on the right, I always face this challenge: Click here for image link For many years, my go-to solution has been using HTML tables like this: < ...

The system does not detect the form

I'm having trouble with my form not being recognized. I've gone over everything multiple times but still can't find the mistake. The PHP code is supposed to take the information from the form and display it, but I keep getting an error that ...

Create a stylish frame for a uniquely shaped picture

   Currently working on a team page for a company, looking to incorporate an irregular-shaped png image with a red border. The desired outcome should resemble the following:             https://i.sstatic.net/ba7ek.png The image provided fo ...

Is it important to position elements based solely on the parent container?

My frustration with element positioning persists: <div id="container"> <div id="div1"></div> <div id="div2"></div> <div id="div3"></div> </div> #div1 { right:0; // I want its right border to be 0px from th ...

Cannot play Apple Trailer URLs using the <video> tag

I'm struggling to embed an HTML5 video player on my website. Here is the code I am using: <video id="player" controls="controls" width="100%"> <source src="http://trailers.apple.com/movies/paramount/captainamerica/captainamerica-tlr1_h. ...