Bottom Div in a Bootstrap 4 Carousel

I'm currently attempting to add a div containing 4 fontawesome icons at the bottom of a bootstrap 4 carousel. However, I am facing an issue where the div is positioned right next to the menu button. My goal is to achieve a layout similar to this: https://i.sstatic.net/IzrmT.jpg I have successfully set up the carousel, but I am unsure about how to properly position the div at the bottom.

This is the HTML structure:

<div id="home-carousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
    <div class="carousel-item active">
        <img class="d-block w-100" src="<?php echo base_url('assets/images/slider1.jpg');?>" alt="First slide">
        <div class="carousel-caption d-none d-md-block">
            <h2 class="animated bounceInRight to-deelay">Order Your Favorite Meal</h2>
            <button class="btn btn-primary menu-button animated bounceInLeft to-deelay">Menu</button>
            <div class="test-div">
                test
            </div>
        </div>
    </div>
    <div class="carousel-item">
        <img class="d-block w-100" src="<?php echo base_url('assets/images/slider2.jpg');?>" alt="Second slide">
        <div class="carousel-caption d-none d-md-block">
            <h2 class="animated bounceInRight to-deelay">Order Your Favorite Meal</h2>
            <button class="btn btn-primary menu-button animated bounceInLeft to-deelay">Menu</button>
            <div class="test-div">
                test
            </div>
        </div>
    </div>
    <div class="carousel-item">
        <img class="d-block w-100" src="<?php echo base_url('assets/images/slider3.jpg');?>" alt="Third slide">
        <div class="carousel-caption d-none d-md-block">
            <h2 class="animated bounceInRight to-deelay">Order Your Favorite Meal</h2>
            <button class="btn btn-primary menu-button animated bounceInLeft to-deelay">Menu</button>
            <div class="test-div">
                test
            </div>
        </div>
    </div>
</div>
<a class="carousel-control-prev" href="#home-carousel" role="button" data-slide="prev">
    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#home-carousel" role="button" data-slide="next">
    <span class="carousel-control-next-icon" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
</a>

Here is the CSS styling involved:

    .carousel-caption{
    padding-bottom: 150px;
}
.carousel-caption h2{
    font-size: 50;
    text-transform: uppercase;
    padding-bottom: 100px;
}
.carousel-caption{
    color: black;
    font-size: 25px;
    font-weight: bold;
}
.to-deelay{
    animation-delay: 0.5s;
}
.menu-button{
    width: 160px;
    background-color: #C0B283;
    border: 0;
}
.carousel-caption button{
    text-align:center;
    background: linear-gradient(to right, #C0B283 50%,#DCD0C0 50%);
    background-size: 200% 100%;
    transition:all 1s ease;
}
.carousel-caption button:hover{
    background-position: right bottom;
}

.test-div{
    width: 70%;
    background-color: red;
    margin: 0 auto;
}

Furthermore, what would be the most effective way to space out the elements within the carousel caption?

Answer №1

Let's start with a solution to your question.

If you aim to place the div containing icons and text just above the carousel-control-prev element, then your HTML code should resemble:

<div class="icon-container">
    <div class="icon-1"> CONTENT </div>
    <div class="icon-2"> CONTENT </div>
    <div class="icon-3"> CONTENT </div>
    <div class="icon-4"> CONTENT </div>
</div>
<a class="carousel-control-prev" href="#home-carousel" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#home-carousel" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>

The concept is to absolutely position the icon-container div at the bottom of the carousel. The pagination elements will be styled similarly but on either side of the carousel respectively.

Hence, your CSS for the container should appear like this:

.icon-container{
   position:absolute;
   width:100%;
   bottom:30px;
   left:0;
   right:0;
}

By adding the position:relative; attribute to the parent, this positioning should align the div appropriately at the bottom of the carousel.

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

Implementing a click event listener to target a specific div using JavaScript

In my JavaScript code, I have implemented a snowfall effect. I am looking to create a click event specifically on the 10th snowflake that falls down. Additionally, I want to add a class called "clickable" to this snowflake. The goal is to redirect the user ...

Ways to center items in a row-oriented collection

When dealing with a horizontal list, the issue arises when the first element is larger than the others. This can lead to a layout that looks like this. Is there a way to vertically align the other elements without changing their size? I am aware of manual ...

Tips for aligning thumbnail text to the right on a small viewport with Bootstrap

Here is a visual representation of the standard thumbnail layout Once the viewport reaches the small size, the layout should switch to this design: Bootstrap only shrinks the container by default, as demonstrated in this jsfiddle: http://jsfiddle.net/32 ...

What is the best way to use jQuery to apply CSS only to elements with a specific attribute set?

Currently, I am attempting to utilize jQuery to apply specific CSS styles to elements, but only those that possess a particular attribute. The rationale behind not resorting solely to CSS is due to the immense amount of content on the site, making it impr ...

Vertical button group within a Bootstrap 5 input group

How can I create an input-group for increasing or decreasing numbers? Below is the code I have: <div class="input-group input-group-sm"> <input type="text" class="form-control" placeholder="0.9"&g ...

Aligning Content in the Center of a CSS Grid

Having difficulty with a CSS Grid layout that should consist of 7 squares per row to create a calendar style design. The layout seems fine, but I am struggling to center the title and subtitle in the middle of each item. I have tried using margin:auto, ver ...

Tips for adjusting the CSS styles within a jQuery plugin

I need some help with styling the form on my test page located at While using FireBug, I noticed a lot of padding space surrounding the tabs within this div: <div id="tabs-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom"> How can I redu ...

Unveiling the Solution: Deactivating CSS Style Hints in VS Code!

click here to view the image Can anyone guide me on how to turn off the style hint feature in VS Code while working with CSS? ...

Using jQuery to retrieve the location of an element with a specific class

I am working on a slider that adds a class (.current-item) to each active tab and removes it when it's inactive. I am looking to incorporate the LavaLamp effect for the menu, but I am having trouble getting the position of each element with the curren ...

Top method for converting scrolling into an element

When trying to create a scrollable element, I attempted the following: .scroll-content { overflow: hidden; } .scrollabe { overflow-y: scroll; } <ion-content> <ion-grid style="height:100%" *ngIf="plat && ticket"& ...

Icons disappear from the navbar toggle when clicked on a small screen

Using Django and Bootstrap 4, I've created a navbar with a toggle feature. However, when viewed on a small screen, the toggle button does not display the icons as expected. Instead, it shows empty lines. Strangely, when the phone is rotated, the toggl ...

Div with hidden scrollbars for smooth scrolling experience

Is there a way to create scrollable DIV's without visible scrollbars? While Mac OS 10.7-8 display no visible scrolls, other operating systems like Windows, Mac OS, and Linux show the scrollbars. How can I achieve scrollable divs without the scrollbars ...

Another option for document.execCommand('selectAll',false,null)

I've come across a piece of code that allows me to select the text in a div whenever a user clicks on it: <table> <tr> <td> <div contenteditable onClick="document.execCommand('selectAll',false,null)">I& ...

What is the best way to incorporate text below grid columns in html?

Can you show me how to insert text below a column using the grid system? Here is what I am trying to accomplish Here is the code I have created: .grid{ display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; grid-auto-rows: 240px 240px; row-g ...

What is the best way to ensure the navigation bar stays at the top of the window once it has reached

I have a sample js fiddle provided here. The navigation bar is positioned right below the "Hello World" section, and the content follows beneath the nav bar. Is there a way to make the navigation bar stick to the top of the window once it reaches that poin ...

Child div set to 100% height within parent div with auto height

After scouring the internet for hours in search of an answer, I found myself reading articles like Floats 101 on alistapart and browsing through countless similar questions on stackoverflow. I have reached a point where I feel like I must ask my question b ...

Adjust the position of the xAxis on the Highcharts chart to move it downward or

I recently inherited some code from the previous developer that uses highcharts.js (v3.0.1). I'm having trouble with the xAxis appearing within the graph itself (see screenshot). Despite my efforts to recreate this issue in jsfiddle, I can't seem ...

Analyzing CSS transform values for rotate3d utilizing regular expressions

I want to split css transform values into an array, while keeping rotate values grouped together. For instance: 'translate3d(20px, 5px, 10px) rotateX(20deg) rotateY(10deg) rotateZ(0deg) skew3d(20deg, 10deg) rotateX(-20deg) rotateY(100deg) rotateZ(-3 ...

I have developed a custom jQuery carousel that includes functionality to start and stop the carousel based on specific conditions

I have set up a jQuery carousel that moves to the left when a checkbox is checked, but I need it to stop moving when the checkbox is unchecked. Can someone help me achieve this? $("#checkBox").click(function(){ if($(this).prop("checked") == true){ ...

png showing the backdrop, not the background image

Struggling with aligning multiple layers on my website. The primary background of my site is a sleek black #000000. Next, there's a div featuring a centered background image that complements the black backdrop perfectly. I'm attempting to over ...