Having trouble creating a fully responsive carousel using Bootstrap v4-alpha

I am interested in creating a functional carousel similar to this one: However, when I upload my images and resize the carousel for small screens, I encounter an issue where part of the old image holder appears below the images like shown here: I simply want my images to be displayed correctly without any additional elements. Can someone please assist me with resolving this problem?

    <!-- Carousel
================================================== -->
<div id="myCarousel" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
    <li data-target="#myCarousel" data-slide-to="1"></li>
    <li data-target="#myCarousel" data-slide-to="2"></li>
  </ol>
  <div class="carousel-inner" role="listbox">
    <div class="carousel-item active">
      <img src="background1.jpg" alt="First slide">
      <div class="container">
        <div class="carousel-caption text-xs-left">
          <h1>Example headline.</h1>
          <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
          <p><a class="btn btn-lg btn-primary" href="#" role="button">Sign up today</a></p>
        </div>
      </div>
    </div>
    <div class="carousel-item">
      <img src="background2.jpg" alt="Second slide">
      <div class="container">
        <div class="carousel-caption">
          <h1>Another example headline.</h1>
          <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
          <p><a class="btn btn-lg btn-primary" href="#" role="button">Learn more</a></p>
        </div>
      </div>
    </div>
    <div class="carousel-item">
      <img src="background3.jpg" alt="Third slide">
      <div class="container">
        <div class="carousel-caption text-xs-right">
          <h1>One more for good measure.</h1>
          <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
          <p><a class="btn btn-lg btn-primary" href="#" role="button">Browse gallery</a></p>
        </div>
      </div>
    </div>
  </div>
  <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div><!-- /.carousel -->

The structure of the carousel HTML remains the same, along with its corresponding CSS styling. I am trying to integrate it into my project but face difficulties when adjusting it for smaller screen sizes as depicted in the provided image.

 body {
 padding-bottom: 3rem;
 color: #5a5a5a;
 }

.carousel {
 margin-bottom: 4rem;
 }

 .carousel-caption {
  z-index: 10;
 }

 .carousel-item {
 height: 32rem;
 background-color: #777;
 }
 .carousel-item > img {
 position: absolute;
 top: 0;
 left: 0;
 min-width: 100%;
 height: 32rem;
 }

.carousel-indicators {
 top: 1.5rem;
 right: 1.5rem;
 bottom: auto;
 left: auto;
 width: 1rem;
 margin-left: 0;
 }

 .carousel-indicators > li {
 margin-bottom: .25rem;
 }
 @media (min-width: 40em) {

 .carousel-caption p {
 margin-bottom: 1.25rem;
 font-size: 1.25rem;
 line-height: 1.4;
 }

 .featurette-heading {
 font-size: 50px;
 }
 }

 @media (min-width: 62em) {
 .featurette-heading {
 margin-top: 7rem;
 }
 }

Answer №1

It has come to light that there is a known issue with BS 4 alpha. More information can be found at https://github.com/twbs/bootstrap/pull/18258

To address this issue on smaller viewports, one solution is to hide the caption using hidden-sm-down. Alternatively, another workaround involves applying object-fit:cover to the image, although this may not work in older browsers.

.carousel-item > img {
  position: absolute;
  top: 0;
  left: 0;
  min-width: 100%;
  min-height: 32rem;
  object-fit: cover;
}

For further reference, check out

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

What is the functionality of the CSS switch button?

I'm curious about how the cool turn on/off switch button actually works. Take a look at for reference. I'm interested in implementing a prevention check to confirm whether the user truly wants to switch the button. Here's a snippet of the ...

"Using AJAX in PHP will not generate any output when returning JSON

Hey everyone, I'm having trouble with my simple PHP test code. I can't seem to get the err value that I want. 2.php $error = "abc"; $er = json_encode($error); return $er; Here's my HTML: <html> <head> <script src="https:// ...

Looking for a solution to adjust the barely visible menu items on my website's mobile version, after recent changes made by Weebly. How can I make them more noticeable and user-friendly?

A BIT OF HISTORY Some years back, I created my initial Weebly website for my business at www.smehelper.com. The mobile version used to look fantastic! CHANGES OVER TIME However... about a year ago, Weebly made some alterations (I'm not sure what exac ...

How to Delete an Added Image from a Dialog Title in jQuery

I've tried multiple solutions from various sources, but I'm still struggling to remove an image from a dialog. Whenever I attempt to do so, I end up with multiple images instead of just one. It's important to note that I only want the image ...

What is the best way to position a div next to a form field?

My current HTML code is shown below. <div class="field"> <label>E-mail address: </label> <input type="text" id="email" name='email' style="width:200px;"></input> < ...

What could be the reason behind the jPlayer video not playing?

$("#jPlayer").jPlayer({ ready: function () { $(this).jPlayer("setMedia", { flv: 'http://st1.blive.kg/storage/flv7/2/249162.70951.flv' }); }, swfPath: "/js/Jpl ...

When the mouse hovers, the background image of <ul> <li> tabs will disappear

I have a simple set of HTML tabs using <ul> and <li> elements with some custom CSS styles. You can view the code on jsfiddle here. Each tab follows this structure (for more details, please refer to the linked code): ... <li class="icon ...

Creating dynamic email templates in Node.js

I am working on a project using the MEAN stack and I need to implement email functionality. I have created separate email templates, but I want to include a common header and footer in all of them. Route.js router .route('/api/user/register&a ...

Issue with bootstrap3 and django where the pull-right functionality is not functioning as expected

I'm unable to get the pull-right class in Bootstrap 3 to function properly within a Django project: The pull-right class in Bootstrap 3 doesn't seem to work in my Django template. Here's a link to the specific issue I'm facing: pull-ri ...

Tips for resolving a flickering issue that occurs when switching to an input field with our default value / placeholder plugin

In the realm of web development, numerous plugins cater to the implementation of HTML5's placeholder attribute in older browsers. The plugin we have opted for can be found here. Unlike some other alternatives, this particular plugin, with a few modif ...

Adjust the CSS to give <a> elements the appearance of plain text

Is it possible to style an anchor tag to appear identical to plain text? Consider the following scenario: <p> Here is some text and here is a <a class='no-link' href="http://www.example.com" >link</a></p> I have atte ...

Step-by-step guide on displaying a modal dialog in React with the help of Bootstrap

In my project, I am working with react-16 and have used the create-react-app tool along with the vanilla bootstrap 4 library for styling (without additional components). Could someone please provide me with a reference or example where I can learn how to ...

Leveraging CSS or JavaScript for Displaying or Concealing Vacant Content Sections

I'm working on developing a page template that utilizes section headers and dynamically pulled content from a separate database. The current setup of the page resembles the following structure: <tr> <td> <h3> ...

Retrieving information from a JSON file and dynamically displaying it on an HTML page using JavaScript

I've been working on pulling data from a JSON file to display on my website. Following this helpful guide at: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON, but unfortunately, I'm facing an issue where nothing is showing ...

Display an image when the iframe viewport is reduced in size by utilizing media queries

I am looking to showcase a demo.html page within a 400px square iframe. When the viewport is smaller than 400px, I want demo.html to only display an image. Then, when clicking on that image in demo.html, the same page should switch to fullscreen mode. Sim ...

Switching the theme color from drab grey to vibrant blue

How can I change the default placeholder color in md-input-container from grey to Material Blue? I have followed the instructions in the documentation and created my own theme, but none of the code snippets seems to work. What am I doing wrong? mainApp. ...

How to ensure Angular mat-button-toggle elements are perfectly aligned within their respective groups

https://i.stack.imgur.com/Wjtn5.png Hello there, I'm trying to make the numbers in the first group match the style of the second group (noche, mañana...). I've set both the group and individual element width to 100%, but the numbers beyond 22 ...

I am currently engaged in a Portfolio project, where my objective is to ensure that all images are optimized for responsiveness

While Bootstrap ensures that relative images are responsive, absolute images may not be. This can cause alignment issues when the browser window is resized on mobile devices. .title-img { position: relative; width: 100%; height: 100%; } .skill-b ...

Attempting to update the content of a specific div element on a webpage without disrupting its current position

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>ajax div example</title> <script type="text/javascript" src="jscripts/jquery-1.6.4.min.js" ...

Display results in a Web application using Google Apps Script

function doGet() { return HtmlService.createHtmlOutputFromFile("vi"); // var output = HtmlService.createHtmlOutput('<b>Hello, world!</b>'); } function doPost() { return HtmlService.createHtmlOutputFromFile("vi"); // var out ...