How to center align a button in the footer of a Bootstrap card

I'm currently using Bootstrap 5.1.3 and facing a challenge in centering a button within the footer of a card. Below is the code snippet I am working with:

CSS

.btnStandard {
    min-width: 10vw;
}

HTML

<div class="card-footer justify-content-center">                    
   <button type="button" class="btn btn-labeled btn-success d-flex justify-content-between btnStandard">
      <div class="col-10 text-start">Tell Me</div>
      <div class="col-2 text-center"><i class="fa-solid fa-square-info"></i></div>
   </button>
</div>

Despite my attempts, I have been unable to successfully center the button within the card footer. Any suggestions or ideas on how to achieve this?

Answer №1

It appears that the Bootstrap class d-flex was unintentionally left out.

Make the following amendment...

<div class="card-footer justify-content-center">                    
   <button type="button" class="btn btn-labeled btn-success d-flex justify-content-between btnStandard">
      <div class="col-10 text-start">Tell Me</div>
      <div class="col-2 text-center"><i class="fa-solid fa-square-info"></i></div>
   </button>
</div>

...to this.

<div class="card-footer d-flex justify-content-center">                    
   <button type="button" class="btn btn-labeled btn-success d-flex justify-content-between btnStandard">
      <div class="col-10 text-start">Tell Me</div>
      <div class="col-2 text-center"><i class="fa-solid fa-square-info"></i></div>
   </button>
</div>

Answer №2

Consider giving this a try:

<section class="button-container text-center">
   <a href="#" class="btn btn-primary btn-lg">
      Click Here
   </a>
</section>

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

Tips for integrating ng2-dragula into an Angular 2 project

How can ng2-dragula be implemented in Angular 2? Here's the code snippet, ****viewer.component.ts**** import { Component, Input, Output, EventEmitter } from '@angular/core'; import { Injectable } from '@angular/core'; import { ...

Is it ideal to have a single view for the entire Django website?

Imagine wanting to create a website using only one HTML template. One idea is to have a single view that handles all possible inputs and outcomes, such as when a new object is created by clicking a button and a form appears while the rest of the page remai ...

Ensure that the CSS grid has a minimum span of 3 columns, and if a class object is the only item in a grid row, it

I am currently utilizing CSS grid to create the layout for my web application. I need to specify that a particular class should have a minimum grid-column span of 3 frames and extend across the entire grid row if it is the only object in that specific row. ...

Inject pure HTML code into a react div

I have extracted raw HTML content stored in the database and I am attempting to display it within a div element. const style = { border: '2px solid #eee', height: '270px', width: '100%', overflow: 'auto&ap ...

Achieving a 100% height sidebar that remains visible on the screen at all times in Bootstrap

Looking to achieve this specific layout: I want the left col-md-3 to maintain a consistent 100% height and always be visible on the screen - it's going to be a menu. The right side should function normally with scrolling capabilities. Appreciate any ...

Utilizing Selenium to Extract Data from ESPN Website

I am currently working on a project that involves scraping data from ESPN, performing calculations on the scraped data, and then iterating through a dataframe to process player information. While I have successfully completed this task for one player, I am ...

Footer not positioned at the bottom of the page

I have been experimenting with different ways to keep my footer at the bottom of the page. Initially, I tried using position: static, but the footer ended up above the bottom of the page and the background was visible (similar to the image below). Then, I ...

End of ImageButton tag

I am currently working on this code : <div runat="server" class="slide"> <img src="images/picto_detail.gif" onclick='<%# Eval("CampagneRappelId","hideshow(\"details{0}\")")%>' /> <div id='details<%# Eval("C ...

CSS - Overlapping <a> elements when resized

My buttons have the following properties: background: #c6cdf2; border: 1px solid #8896e4; border-radius: 3px; padding: 6px 10px 3px 10px; When the page resizes, the buttons don't respect the padding and start overlapping each other. https://i.sstat ...

Issue with Jquery's .addClass and .removeClass functions

I'm having trouble implementing a dynamic menu on my webpage using jQuery. I've tried writing the code myself but it doesn't seem to be working as expected. The structure involves three classes: .dead, which sets display: none; in CSS, .hea ...

Having trouble with a React child component not reacting to a click event?

The current issue I am experiencing is that the component is not triggering a click event when the button is clicked. TickerPage render() { return ( <div className="TickerPage"> <div className="TickerPage-container"> <b ...

The method WebKitBrowser.StringByEvaluatingJavaScriptFromString does not provide any output

After running all JavaScript, I need to retrieve the HTML content. However, I am facing an issue using WebKit.NET where the method WebKitBrowser.StringByEvaluatingJavaScriptFromString does not return anything, even with a simple alert(). When I try passi ...

Angular JS effectively prevents redundant data from being displayed to users when scrolling infinitely while also efficiently removing DOM elements for previous data

I'm currently working on implementing AngularJS Infinite Scroll without using jQuery. My goal is to display the first 3 data items when the page loads and then load the next 3 data items from a JSON array object as the user scrolls. The issue I am fac ...

Ways to restrict a function to a single DOM element using either its id or class

This script is responsible for dynamically loading pages on my website. It works fine, except that it currently iterates over all anchor tags a on the site, whereas I want it to iterate only through my navigation menu. Here is the navigation menu: <div ...

Inserting a vertical barrier in the midst of the content

I am struggling to create a vertical divider and align the text properly in the top right corner of my screen. https://i.sstatic.net/UqURE.png Currently, I am facing issues with displaying the divider and positioning the text correctly. <div class="r ...

Executing a function with the initial click

Is there a way to run a function only on the first click, without having it run every time? I already have another function running on window.onload, so I can't use that. Both functions work fine independently, but not together. Right now, I'm ca ...

Is it possible that adding html tables together could result in the numbers being concatenated instead of summed?

When attempting to calculate the total sum of values in an html table column, my variable seems to be returning concatenated strings instead of the actual sum. For example, instead of 1 + 2 + 3 = 6, I am getting 1 + 2 + 3 = 123. The values in the "votes" ...

What is the best way to emphasize a specific data point within a chart created with chartjs, especially when the data is sourced from a JSON

// Here I am retrieving another set of data in JSON format from a PHP file $(document).ready(function () { showGraph(); }); function showGraph() { $.post("phpfile.php", function (data) { console.log(data); var name = []; v ...

Numerous clocks on display

I am trying to display two clocks on my webpage, but for some reason only one clock is showing up. The first clock script is as follows: <script type="text/javascript"> var tmonth=new Array("January","February","March","April","May","June","July"," ...

Tips for eliminating the default margin without using a float

Exploring the world of divs and buttons led me to an interesting discovery: removing a float creates a natural margin. Upon entering this styling: body { background: gray; } button { font-size: 17px; color: white; margin-l ...