Separate the footer of a Bootstrap 4 card into two distinct sections

I am currently working with the footer system in bootstrap 4 and I have a specific requirement. I need to place two buttons next to each other in the footer, filling the available space.

Here is an example of what I am trying to achieve: see here for current bootstrap footer button

The existing button in the picture uses all the available space. What I want to do is modify it so that the green checkmark appears on the left side, and a red button on the right side. Both buttons should fill the available space within the footer and be of equal width. I do not want them floating in the footer independently.

This is my code for creating a single full-width footer button:

<a class="card-footer" style="background-color:#85e085">
    Check In
</a>

Below is the code I tried for generating a 2-button footer, but it did not give me the desired output:

<div class="row">
    <a class="col-sm-6" style="background-color:#85e085">
        Check In
    </a>
    <a class="col-sm-6" style="background-color:#85e777">
        Check In
    </a>
</div>

I have attempted different approaches like using divs for containing the footer and applying column classes, as well as experimenting with flex boxes. However, none of these methods gave me the desired outcome. Any help or guidance would be greatly appreciated!

EDIT: Here is the final code I arrived at after considering the accepted answer:

<div class="container card-footer" style="padding:0!important;">
    <div class="row" style="margin:0!important;" >
        <a class="col-6" style="background-color:#85e085;text-align:center;padding:1em 0em">
            Check In
        </a>
        <a class="col-6" style="background-color:#85e777;text-align:center;padding:1em 0em;">
            Check In
        </a>
    </div>
</div>

Answer №1

To achieve the desired display of links, you might need to set the padding and margin to zero on the card-footer and row elements, as I have done in my code snippet.

I find it unnecessary that you escape the double quotes in your HTML code.

<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b3d1dcdcc7c0c7c1d2c3f3869d839d81">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

<div class="container">
  <div class="card">
    <div class="card-header">
      A card
    </div>
    <div class="card-body">
      <h4 class="card-title">Card title</h4>
      <p class="card-text">Some text</p>
    </div>
    <div class="card-footer" style="padding:0!important;">
      <div class="row" style="margin:0!important;">
        <a class="col-sm-6" style="background-color:#85e085;text-align:center;">
                Check In
              </a>
        <a class="col-sm-6" style="background-color:#85e777;text-align:center;">
                Check In
              </a>
      </div>
    </div>
  </div>

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

Semantic UI Troubles: Unraveling the Sidebars and #pusher Defects

Hey there, I could really use some assistance with an issue I'm facing. I have this particular structure that's causing me trouble. <div id="toolbar" class="toolbar overlay-displace-top clearfix toolbar-processed"> ... </div> < ...

The CSS transition fails to animate with dynamically loaded Ajax content

My journey into the world of CSS animations is relatively new, with some previous experience in JQuery. However, I encountered a problem with choppy animations on smaller devices like my iPad, nook, and android phone. To address this issue, I decided to us ...

"Interacting with a button using jQuery: clicking and moving the

Here is the code I have: <html> <head> <script src="js/jquery.js"></script> <script type="text/javascript> function showMenu() { $('#mm').slideDown("slow"); } $(document).ready(function(){ $('#mm').hide(); ...

Transferring information from JSON to HTML

Recently, I came across this handy design tool within our service that helps generate Gauge charts by simply adding a specific div class to the desired pages. <div class="gauge" id="g0" data-settings=' { "value": ...

Input fields that are dynamically generated do not respond to changes made using .click and .blur methods in jQuery CSS

I'm experiencing an issue with a HTML form where a new input field is generated when a button is clicked, but the dynamically created field is not styled properly. Below is the HTML form code: <form id="form"> <input type="text" id="ent ...

Tips for maintaining the size of a div container

Take a look at the following code snippet: <head> <title></title> <style> .section_divs { background-color: lightblue; float: left; } #section_empty { background-color: tomato; width ...

jQuery plugin stops functioning properly following the use of the jQuery display block method

In my project, I am exploring the use of divs as tabs with jQuery. Within these divs, I also want to incorporate another jQuery plugin. Currently, I have manually created these div tabs using jQuery and set the default style for second and subsequent divs ...

Running ASP.Net with HTML5 JS and Twitter Bootstrap produces a unique design

During development, everything appears to be working fine in my environment. I have a pie chart that uses canvas and animation, and it displays correctly when hosted through the browser. Additionally, I am utilizing Twitter Bootstrap and have a navigation ...

I can't seem to figure out why the removeChild() function is not functioning properly in my

Recently, I've been working on a search website where users can input either a partial or full name and then click a button to display a list of actors whose names contain that specific string in a hint-like fashion. These names are sourced from a MyS ...

What is causing the .hta to be unable to locate the program with this path string?

. I am looking to develop an .hta program with a button that, when clicked, will open any program for which I can provide a path. Initially, I was successful in running Notepad using the path without spaces within system32. However, when attempting to do t ...

Is the HTML templating mechanism compatible with Angular?

Trying to implement HTML templating in my Angular application, my code looks like the following: <script type='text/html' id="sampleId">...</script> However, upon loading the HTML, I noticed that the script block was not present in ...

Turning off and on the syntax in CakePHP 2.X

I stumbled upon this example code snippet at http://jsfiddle.net/nc6NW/1/ However, when I attempt to convert it to formhelper syntax, the Jquery script fails to re-enable the disabled save function. Is there a way to remove this attribute using the provid ...

Is it possible for a camera to embody the essence of a texture?

I am currently working on a game using HTML/Javascript with Three.js. One of the key features I have implemented is moving the road and allowing the camera to move as if it were attached to a car controlled by arrow keys. Now, my next challenge is to give ...

Unique Text: "Personalized marker/pin for interactive map feature"

Looking to create a custom image map marker/pin with a unique bottom design resembling a union shape using CSS and Vue.js. I've attempted it myself but haven't been able to achieve the exact look as shown in the reference image. Any advice or ass ...

Irregular dimensions of div elements following automated selection

My tile div can be selected using the mouse or a timed event. Here are the states of selected and unselected : Not .selected .selected applied .tile { height: 70px; padding: 5px 10px 5px 10px; margin: 8px auto 0px auto; width: 280px; ...

Adjust the translateX value and element size based on either the parent element's size or the window's dimensions

Is this question specific enough to relate to others' problems? My issue involves two elements, a child and a parent, with the child element rotating around the parent using CSS animations. <div class="planet"> <div class="moon"></di ...

Can you explain the functionality of the NextSibling method?

I have a question about how the property NextSibling behaves when using the method getElementsByClassName(). Let me illustrate the issue with this code example: function Sibling() { var x = document.getElementsByClassName('firstClass')[0]; ...

How can we ensure that the entire BS4 Navbar (on smaller screens) is clickable, allowing users to show/hide the submenu by touching anywhere within the area?

https://i.sstatic.net/03po7.png My goal is to make the entire navbar area touchable, rather than just having a button. I believe this can be achieved by adjusting the default Bootstrap 4 navbar settings: HTML: <nav id="menu-navbar" class="navbar navb ...

Email Form Application: Utilizing NodeJs and Express - Error: URL Not Found /

I'm encountering a "cannot GET" error whenever I try to run my application on a live server using VS Code. My assumption is that the issue lies within my routing configuration, but I'm struggling to identify the exact problem. Any assistance woul ...

Building a 3D Earth model using three.js for WebGL applications

I found a code online, but it doesn't seem to work. Can someone provide me with the HTML code needed to make it run in my browser? The original code was sourced from this website (github repository) Github code repository https://github.com/turban/ ...