Tips for aligning carousel indicators in Bootstrap 4

My objective is to reposition the indicators below the slider image by setting the .carousel-indicators with a bottom: -50px; property. However, when I implement this, the indicators simply disappear. I suspect that this issue is related to the overflow:hidden attribute of the slider, but I haven't been able to resolve it.

Below is the code I am working with:

<div id="slider" class="carousel slide" data-ride="carousel">
    <ol class="carousel-indicators">
        <li data-target="#slider" data-slide-to="0" class="active"></li>
        <li data-target="#slider" data-slide-to="1"></li>
        <li data-target="#slider" data-slide-to="2"></li>
        <li data-target="#slider" data-slide-to="3"></li>
        <li data-target="#slider" data-slide-to="4"></li>
    </ol>

    <div class="carousel-inner">
        <div class="carousel-item active">
            <img class="d-block w-100" src="header.jpg">
        </div>
        <div class="carousel-item">
            <img class="d-block w-100" src="slider2.jpg">
        </div>
        <div class="carousel-item">
            <img class="d-block w-100" src="slider3.jpg">
        </div>
        <div class="carousel-item">
            <img class="d-block w-100" src="slider4.jpeg">
        </div>
        <div class="carousel-item">
            <img class="d-block w-100" src="slider5.jpeg">
        </div>
    </div>
</div>

Here is the CSS code:

#slider {
    height: 350px;
    overflow: hidden;
    width: 100%;
}
.carousel-indicators li {
    width: 10px;
    height: 10px;
    border-radius: 100%;
}
.carousel-indicators {
    bottom: -50px;
}

Answer №1

Applying bottom: -50px to .carousel-indicators successfully relocates the indicators beneath the carousel. However, due to the overflow: hidden property, the indicators are obscured from view, as you correctly hypothesized. They are simply cut off when they extend beyond the carousel's boundaries.

Instead of adjusting the height and overflow settings of the #slider element, I recommend defining the height within the .carousel-item class, as shown below:

.carousel-item {
    height: 350px;
}

.carousel-indicators li {
    width: 10px;
    height: 10px;
    border-radius: 100%;
}
.carousel-indicators {
    bottom: -50px;
}

This modification does not affect the placement of the indicators.

You can view a functional demonstration on Codepen.

Answer №2

I found success with this piece of code!

 .carousel-indicator {
   position: relative;
   bottom: -50px;
 }

Adjusting the position of the indicators helped in displaying my paragraph properly.

Answer №3

Recently, I encountered a similar issue but managed to resolve it by changing the flex-direction of the div to column-reverse. While my solution may be a bit overdue, I believe it could assist others facing the same problem.

Answer №4

To utilize the bottom property, the element must be positioned as relative, absolute, or fixed. When set as relative, the bottom property causes the element's bottom edge to shift either above or below its original position.

.carousel-indicators {
position: absolute;
bottom: -50px;
}

If the element is already correctly positioned, setting bottom to -50px may cause it to be placed outside the visible area of the parent element #slider. To resolve this, try removing the overflow: hidden; property from #slider and observe the new position of carousel-indicators.

Answer №5

I successfully positioned these indicators at the bottom center of the background image slider. It's now working perfectly.

.carousel-indicators{
  position:absolute;
  right:0;
  bottom:150px;
  left:0px; 
 }

Answer №6

After experimenting, I discovered a solution that worked perfectly for me!

.carousel-indicators{
position: absolute;
bottom: -50px;
}

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

Using Flexbox to align content in a column with space between items

Is there a way to move the read more button to the bottom of the card using flexbox in a column layout? The top section, middle paragraph, and see more button are each contained within their own div inside the parent card div. https://i.stack.imgur.com/NG ...

Can the loaded image from the css sprite be displayed on the screen?

My webpage is designed to load two images from a CSS sprite using the following code: <html> <head> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body> <div class="arrow low"></div> ...

Grid layout with Tailwind

I'm facing a challenge in my Angular project where I need to create a grid layout with 2 rows and 6 columns using Tailwind CSS. The actors array that I am iterating through contains 25 actors. My objective is to show the first 12 actors in 2 rows, fo ...

What could be causing the issue with my Date and Time input not functioning correctly?

I developed a React frontend application styled with Material UI design. The issue I am facing is that after adding the Date and Time component styling to the form, it is unable to process the "name" value for posting. Specifically, the error message "Ty ...

Improving the layout of text by adjusting the width within a flex-box styled card

I have a card with the style property "display: flex;" applied to it along with other stylings, all of which are checked in the snippet below. My goal is for the text within the card to move to a new line once its width reaches either 120px or 7 ...

Utilize Flexbox to position a group of items in the center of the page, while placing a single item at the bottom for added emphasis

I have utilized Bootstrap 4 along with some custom CSS to create a hero section where all items are centered both horizontally and vertically. The only exception is one item that I want to align at the bottom of the page while still keeping it centered ho ...

Discover the secret to toggling Bootstrap 4 cards visibility when hovering over the navigation menu using CSS

Hey, I'm currently working on a project where I want to show and hide specific sections of cards by just hovering over the menu list. While I can successfully hide the cards using CSS, I am facing issues with displaying them using the display:block pr ...

When creating a dynamic page number using JavaScript during a print event, the height of an A4 page is not taken into

While creating my A4 invoice using HTML, CSS, and JS, everything appears correctly in the print preview. However, I am encountering an issue where the page number is not aligned properly and extra empty pages are generated automatically. Below is a snippe ...

CSS might not always work properly on all web browsers, but it functions perfectly on Eclipse

When developing JSF pages with stylesheets, everything seems to be working fine in the Eclipse preview function. However, when I test the pages on IE8, the styles do not seem to have any effect. I am utilizing composite views to define a general layout fo ...

Tips for aligning sections of a navigation bar in different directions: left and right

I'm attempting to float a logo to the left side of a nav bar and have the text float to the right of the nav bar using Bootstrap. I've tried adding float and text align classes to outer divs and specific elements but haven't had success yet. ...

The JavaScript code will automatically execute loops

Let me illustrate my point with two functions. Function 1 This function triggers a transition when you hover over the square. If you move your mouse off the element and then back on while the transition is still in progress, it will wait until the end of ...

What causes certain divs to protrude when the parent div has overflow:hidden property enabled?

Issue: I am facing difficulty aligning all elements within one div without any overflow issues. Even with the parent div set to overflow:hidden, some child divs are protruding out of the container. How can I resolve this problem? Example: http://jsfiddle. ...

Adjustable div height: reduce until reaching a certain point and then begin expanding once more

Incorporating a hero section to display content is my current approach. The design adapts responsively utilizing the padding-bottom percentage strategy, along with an inner container that is absolutely positioned for central alignment of the content. The ...

`Modified regions determined by cursor location`

I am working with a split layout featuring two columns, and I need the ability to make each column separately scrollable. Due to using a specialized scroll-to function, I cannot use overflow-y: scroll; or overflow: auto;. I am looking for alternative solut ...

How to disable the automatic sliding of the Twitter Bootstrap carousel when the page first loads

Is there a way to stop the Twitter Bootstrap carousel from automatically sliding when the page loads, and only start sliding when the next or previous button is clicked? Thank you ...

Resolving CSS Fluid Image Problem

Even though my site background is responsive and functions well, I am encountering problems with the images. I want them to appear "fixed" in the same position as the background, regardless of resolution changes. For example, resizing the browser from 990p ...

Creating a javascript function to update content on click

Recently, I've been designing a webpage and encountered an issue. I want the text in a specific area to change whenever a user clicks on a link. Below is the code snippet related to the section I want to modify using a JavaScript function. <div id ...

What is the best way to use @foreach to make the text in the final row of a table bold?

Is there a way to apply bold styling to the text in the final row using @foreach in HTML? I am looking to emphasize the total sum of each column by displaying it in bold text. While I initially considered creating a new table below the current one solely ...

Tips for creating scrollable popovers in Bootstrap 4

I came across a similar question, but the solution provided didn't work for me and I'm not sure why. Why is my popover content not scrolling when it exceeds 50px? Also, a side question: I'm facing an issue with newlines within the popover wh ...

Is there a way to eliminate the space between the content inside a table cell and its borders?

I am struggling with a table setup that includes three columns and multiple rows. The first column contains an image, causing the cells in that row to resize based on the image size. When text is added to the 2nd and 3rd columns, it automatically centers w ...