The carousel image slider seamlessly transitioning from the second image

I'm having an issue with the Carousel slider where it is overlapping the image from the second slide onwards. The first image loads properly, but subsequent images are not displaying correctly. Here's a reference image:

CSS

.slide {
height: 473px;
min-width: 100%;
position: relative;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}

HTML

<div class="hero-slider-wrapper">
  <div
    class="slide transition-enabled"
    style="left: -100vw; background-image: url('i1.png')"
  ></div>
  <div
    class="slide transition-enabled"
    style="left: -100vw; background-image: url('i2.png')"
  ></div>
  <div
    class="slide transition-enabled"
    style="left: -100vw; background-image: url('i3.jpg')"
  ></div>
  <div
    class="slide transition-enabled"
    style="left: -100vw; background-image: url('i4.png')"
  ></div>
</div>

In the HTML, the left style property is dynamically determined. However, I am unsure why the images are overlapping starting from the second slide.

Answer №1

After encountering this issue on my own website, I was able to find a solution. The key was to adjust the min-width property from 100% to 100vw

.slide {
        height: 520px;
        min-width: 100vw; // important change here
        position: relative;
        background-position: center;
        background-repeat: no-repeat;
        background-size: cover;
}

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 best way to enable a DOM element's height to be resized?

I have a widget displayed in the corner of my browser that I would like to make resizable by dragging the header upwards to increase its height. The widget's position remains fixed with its bottom, left, and right properties unchanged, but I need the ...

Deactivate user input depending on a certain requirement

Greetings everyone, I am currently working with the following code snippet: <table class="details-table" *ngIf="peop && peopMetadata"> <tr *ngFor="let attribute of peopMetadata.Attributes"> <td class="details-property"&g ...

Tips for avoiding the display of the overall scrollbar while utilizing grid with an overflow:

In my react-redux application, I am utilizing the material ui Grid component for layout design. The structure of my code is as follows: <div> <Grid container direction="row" spacing={1}> <Grid item xs={3}> ...

Animation does not trigger before switching pages

I'm attempting to create an animation that occurs before the page transitions. After finding a jQuery script on this site and tweaking it to match my HTML, I realized the code works in a fiddle but not on my actual page. Any assistance would be greatl ...

Retrieving data from a <span> element within a webpage created using ReactJS

I am completely new to the world of web design and development, so there may be some mistakes in my request. Essentially, I have a webpage that contains numerous span tags like the following example: These span tags are part of a significantly large DOM t ...

Eliminate any undefined data in the popup map of Javascript

I am working with JSON data that is being displayed in a pop-up on a map. In cases where there is missing data (Visibility), the word undefined appears in the pop-up. Is there a way to remove the undefined text so that it does not show up in the pop-up? ...

Is there a way to create a "navigate to" button directly from the text within a <p> element?

Within my HTML, there is a <p> tag which dynamically receives a link value from a JavaScript function. The link could be anything from www.google.com to youtube or instagram. How can I utilize the "copytoclipboard" library to copy this link to clipbo ...

Stacking issue - elements not properly aligned

Is there a way to move my H1 text below the blue category button instead of beside it? Thank you in advance! http://jsfiddle.net/TDBzN/ <div id="article" class="animated2 fadeInLeftBig"> <div class="article-close"></div> <div c ...

Styling in CSS to ensure scrollbar is constantly displayed without narrowing the container's width

Is it possible to have a vertically scrollable div with an always visible scrollbar without the scrollbar affecting the width of the elements inside? I attempted some CSS modifications, but the scrollbar still reduced the available width of the div. Is th ...

The error "relative error: invalid property value" occurs when setting the width and height of a parent element

I'm having trouble getting my h2 text to appear above my images when hovered over. I keep receiving an error message in Chrome Developer Tools saying that "display: relative" is not a valid property value, but I can't figure out why. I've se ...

Change a portion of the CSS background-image URL using vanilla JavaScript for a set of pictures

My current code successfully updates part of an src URL for regular images. let svgz = document.querySelectorAll(".svg"); for (let i = 0; i < svgz.length; i++) { svgz[i].src = svgz[i].src.replace("light", "dark"); } Now, ...

Does the web browsing context within an iframe get reset when updating or specifying the src or srcDoc attributes?

Based on the official HTML5 specifications, it is stated that: When an iframe element is removed from a document, the user agent must discard the nested browsing context, if any This leads me to question whether changing the src or srcDoc attributes al ...

What is the process for transferring data (BLOB datatype) to a different table?

I need assistance with transferring data from one blob to another table in the same data type blob. However, I encountered an error message regarding SQL syntax: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB serv ...

Hide specific content while displaying a certain element

Creating three buttons, each of which hides all content divs and displays a specific one when clicked. For instance, clicking the second button will only show the content from the second div. function toggleContent(id) { var elements = document.getEl ...

Is it possible to incorporate a Node.js library into an HTML document?

I am working on an HTML file where I want to incorporate the nodemailer library to handle email sending. Although in nodejs, I can easily include var nodemailer = require('nodemailer') at the beginning of the script section of my HTML file, it ap ...

Height not being generated by Div element

I am encountering an issue with a div element that contains an h2 and three nested div elements. Despite not explicitly setting a height for the container div, it is not expanding to accommodate the varying heights of the inner divs. This problem is causin ...

How far apart are two surfaces when they are rotated along the Y-axis

Access Code: Click here to access the code I am trying to make sure that the red surface lies completely flat on top of the gray surface. However, there seems to be a gap (marked ??) between the two surfaces when I rotate 'modifier1'. How can I ...

Creating a nested structure using JQuery with dynamically generated divs and select tags

My current task involves creating forms and generating corresponding div elements, but my main concern lies elsewhere. What I am seeking guidance on is how to establish a hierarchy among these dynamically generated div elements using the <select> ta ...

Is there something I'm overlooking in my image navigation? It doesn't seem to be interactive

Looking for assistance regarding the issue below. I can't seem to make my image clickable, and I'm not sure what's causing this problem. <img src= "makeup.html.jpg" alt= "Make up by Lauren Evans logo" title= "Make ...

Executing the SQL query more than once is not permitted

I seem to be facing a challenge in executing SQL queries multiple times. In the given code snippet, the first SQL query 【SELECT h.title, h.place, h.introduction ~】works fine. However, the second one 【SELECT name ~】fails to execute. If I comment ...