Tips for positioning a div at the bottom using Bootstrap

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3d5f5252494e494f5c4d7d08130c130e">[email protected]</a>/dist/css/bootstrap.min.css">
<div class="col-6">
  <div class="cell">
    <div class="d-flex justify-content-center">
      <h1>Product</h1>
    </div>
  </div>
  <div class="cell">
    <hr class="w-100" size="5" />
  </div>
  <div class="cell">
    <h3>price €</h3>
  </div>
  <div class="cell">
    <hr class="w-100" size="5" />
  </div>
  <div class="cell">
    <p class="lead">ART_DESIGNATION</p>
  </div>
  <div class="align-text-bottom">
    <div class="cell">
      <form class="position-fixed" action="" method="GET">
        <div style="display: inline;">
          <label>Quantité </label>
          <input style="" type="number" placeholder="1" class="form-control">
          <button style="" type="submit" class="btn btn-primary">Ajouter au panier</button>
        </div>
      </form>
    </div>
  </div>
</div>

The webpage :

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

I want to align the form (label, input, button) in one line and at the bottom of the page like this :

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

However, I am unable to achieve this.

Can you provide assistance?

I have tried using Bootstrap classes to position the button as well as creating my own CSS properties, but none seem to give the desired result. I attempted the suggestions in this post, but they did not work for me and I prefer not to resurrect an old thread: How to align div to bottom inside div bootstrap

Answer №1

To ensure proper alignment, make sure to utilize the Bootstrap grid system effectively.

Check out the code snippet provided below for reference:

.col-6 {
  border: 1px solid red;
  height: 500px;
}

img {
  object-fit: cover;
}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e88a87879c9b9c9a8998a8ddc6d9c6db">[email protected]</a>/dist/css/bootstrap.min.css">

<div class="row">
  <div class="col-6">
    <img class="w-100 h-100" src="https://animals.sandiegozoo.org/sites/default/files/2016-11/animals_hero_giraffe_1_0.jpg" alt="">
  </div>
  <div class="col-6">
    <div class="row align-self-end h-100">
      <div class="col-12">
        <div class="cell">
          <div class="d-flex justify-content-center">
            <h1>Product</h1>
          </div>
        </div>
        <div class="cell">
          <hr class="w-100" size="5" />
        </div>
        <div class="cell">
          <h3>price €</h3>
        </div>
        <div class="cell">
          <hr class="w-100" size="5" />
        </div>
        <div class="cell">
          <p class="lead">ART_DESIGNATION</p>
        </div>
      </div>
      <div class="col-12 d-flex align-items-end">
        <div class="cell">
          <form action="" method="GET">
            <div style="display: inline;">
              <label>Quantité </label>
              <input style="" type="number" placeholder="1" class="form-control">
              <button style="" type="submit" class="btn btn-primary">Ajouter au panier</button>
            </div>
          </form>
        </div>
      </div>
    </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

Problem with the `file` input not working properly

Currently, I am working on creating a form with two input fields - one for text and the other for file upload. However, the issue I am facing is that the Browse button for the file input is being displayed inside the input box. My goal is to have the butto ...

The updated Bootstrap 4 carousel is only working halfway as expected when attempting to double it up, causing the scroll loop to stop functioning

Discovering a fantastic carousel modification was an exciting find, which can be accessed Here. However, when attempting to place two carousels on one page, issues arose with the scrolling functionality. While I managed to make them operate on the correct ...

Tips for increasing the size of a parent div when a child div is displayed with a set width?

Is there a way to make the parent div automatically expand when the child div with a fixed width is displayed onclick? Goal: I want the child div to show up when I click the link, and at the same time, I need the parent div to expand or scale to fit the ...

Leveraging BeautifulSoup for retrieving targeted dl and dd item listings

Today marks my first time posting. I am currently utilizing BeautifulSoup 4 and Python 2.7 (PyCharm) to work on a webpage that contains various elements. Specifically, I am aiming to extract certain elements where the tags are either 'Salary:' or ...

When trying to find a substring within a string in JavaScript, the "else if" statement may not be triggered

I'm currently working on creating a Hangman game using HTML and JS. Most of the code is functioning properly, but I've hit a roadblock. For some reason, one part of my if else statement isn't working correctly. Here's the line of code: ...

Aligment issues in columns on Bootstrap 5

I currently have a layout using Bootstrap 5 with multiple rows and columns. My goal is to have the columns aligned within each row, but I am experiencing issues where some borders are not lining up correctly with the columns. .VI-border { border-t ...

Exploring the Relationship Between Z-Index and Overflow in a Collapsible Div Featuring Slim Select

Here is my demonstration of embedding a Slim Select dropdown within a collapsible div: CodePen Example <html> <head> <!-- MULTIPLE SELECT DROPDOWNS --> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ ...

Unable to retrieve the value from a textarea when using Shopify Product Options by Bold

I'm currently facing an issue trying to retrieve the value of a textarea using Shopify's Product Options by Bold. The code works fine locally, but when I transfer it over to Shopify, I am unable to get the value. Despite looking at various resour ...

Refresh numerous HTML <div>'s using data from a JSON object

Looking to automatically update the homepage of my website with the ten most recent "posts" from the server. Here's an example HTML format: <div id="post1"> <p id="link"> </p> </div> <div id="post2"> <p id="li ...

The HTML button fails to respond when clicked

My website development process has hit a snag with the header buttons not functioning properly. I suspect the issues lie within lines 12 to 15 of the code snippet below: <!DOCTYPE html> <html> <head> <script src="https: ...

Is the table not displaying properly in the print preview with a messy

I have a large table with multiple rows. Due to its length, I have provided a link to the jsfiddle where you can view it: jsfiddle. The table is structured in HTML and contains many rows with various attributes. <table> <thead>text here!</t ...

Display Google Maps and YouTube videos once user consents to cookies

I recently installed a plugin on my WordPress site called Cookie Notice, which I found at this link. So far, I've been impressed with how user-friendly and lightweight it is. Due to the latest GDPR regulations, I now need to figure out a way to hide ...

Obtaining a list of child span elements using xpath in Selenium

I am looking to retrieve all child span elements based on the following xpath //label[@for='someText']/span Expected result: <span class="someClass">"Find this text"</span> <span id="someId">" ...

Is it possible to eliminate a style that was applied using the .css() method?

Currently, I am using jQuery to modify the CSS and would like to know how to remove the styling that is being applied based on the input value provided: If the color is not '000000', then change the background-color of the body element to the sp ...

Loading SVG images in advance

I am in possession of around one hundred simple SVG images, distributed among five different image folders. These images are currently retrieved on demand when they need to be displayed, which generally works well but occasionally results in flickering tha ...

embedding an Image onto a webpage without requiring a source

How can I incorporate an image into my HTML page and then send it via fax without using the "src" attribute? Any suggestions on converting the image to a byte array and embedding it in the html document? ...

The contenteditable div's selectAll feature doesn't function properly when it gains focus

I'm working with divs in a table structure and here's an example: <div contenteditable="true" onfocus="document.execCommand('selectAll',false,null)">Something</div> Clicking on a div to focus works perfectly, selectin ...

Challenges encountered when redirecting users with a combination of javascript and php

I have a login form that triggers a JavaScript function upon submission. This function calls a PHP page to process the input. The issue I'm facing is with how the redirections are displayed based on the user's role type. It attempts to display t ...

What is the best way to customize the appearance of these two images within a div element?

While working on a small website project during my internship, I initially used an inline stylesheet. However, upon my boss's recommendation, I switched to an external stylesheet. Now, I'm trying to figure out how to style the two images within d ...

The highlight_row function seems to be delayed, as it does not trigger on the initial onClick but works on subsequent clicks. How can I ensure it works properly right from the first click?

I developed an application using the Google JavaScript Maps API to calculate distances between addresses. I've encountered a bug where the row in the table is not highlighted on the first click, requiring a second click for the highlighting to take ef ...