One div's content is merging with another div

 <main>
<!--      Carosel-->
      <div>
        <div class="carousel">


          <button class="carousel__button carousel__button--left is-hidden">
              <img src="Image/left-arrow-svgrepo-com.svg" alt="">
          </button>

          <div class="carousel__track-container">
            <ul class="carousel__track">

              <li class="carousel__slide current-slide">
                <img class="carousel__image" src="Image/campbell-3ZUsNJhi_Ik-unsplash.jpg" alt="">
              </li>

              <li class="carousel__slide">
                <img class="carousel__image" src="Image/marc-kleen-8hU6vtwY8l8-unsplash.jpg" alt="">
              </li>

              <li class="carousel__slide">
                <img class="carousel__image" src="Image/marc-kleen-C9j8S_tIFLU-unsplash.jpg" alt="">
              </li>

            </ul>
          </div>

          <button class="carousel__button carousel__button--right">
              <img src="Image/right-chevron-svgrepo-com.svg" alt="">
          </button>

          <div class="carousel__nav nav-dots">
            <button class="carousel__indicator current-slide"></button>
            <button class="carousel__indicator"></button>
            <button class="carousel__indicator"></button>
          </div>
        </div>
      </div>

      <section>
        <div></div>
        <div></div>
        <div></div>
      </section>
      <section>
        <div></div>
        <div></div>
      </section>
      <div>
        <h3 id="happy">Happy Clients</h3>
        <div></div>
        <div></div>
        <div></div>
      </div>
    </main>

That div with the happy clients is going inside the 3 dots nav that i have like it isn't even there, I can increase margin but that's a temporary solution, can anyone tell me why the div with the h3 can not see the nav dots, and here is my css.

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

.carousel{
    position:relative;
    height:800px;
    width: 90%;
    margin: 0 auto;
    border: red solid 2px;
}

.carousel__image{
    width:100%;
    height: 100%;
    object-fit: cover;

}

.carousel__track-container{
    background: lightgreen;
    height:100%;
    position: relative;
    overflow: hidden;

}

.carousel__track{
    padding:0;
    margin: 0;
    list-style:none;
    position: relative;
    height: 100%;
    transition: transform 250ms ease-in;
}

.carousel__slide{
    position: absolute;
    top:0;
    bottom:0;
    width:100%;
}

.carousel__button{
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border:0;
    cursor: pointer;
}

.carousel__button--right{
    right:-40px;
}

.carousel__button--left{
    left:-40px;
}

.carousel__button img{
    width:20px;
}

.nav-dots{
    display: flex;
    justify-content: center;
    padding: 10px 0;
    margin-bottom: 10px;
}

.carousel__indicator{
    border:0;
    border-radius:50%;
    width:15px;
    height:15px;
    background: rgba(0,0,0,.3);
    margin:0 10px;
    cursor: pointer;
}

.carousel__indicator.current-slide{
    background: rgba(0,0,0,.75);
}

.is-hidden{
    display: none;
}

and that is my CSS that I used for html i tried to change it with margin and padding, but i want to know why it does not see the nav dots at all

as u can see in the photo it stops below that image but that image and the nav dots are in the same div

Answer №1

I'm struggling to grasp the concept of what you're trying to accomplish

$(".carousel__indicator").on("click", function() {
  $(".carousel__indicator").removeClass("current-slide");
  $(this).addClass("current-slide");
})
.carousel {
  position: relative;
  height: 800px;
  width: 90%;
  margin: 0 auto;
  border: red solid 2px;
}

.carousel__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel__track-container {
  background: lightgreen;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.carousel__track {
  padding: 0;
  margin: 0;
  list-style: none;
  position: relative;
  height: 100%;
  transition: transform 250ms ease-in;
}

.carousel__slide {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
}

.carousel__button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.carousel__button--right {
  right: -40px;
}

.carousel__button--left {
  left: -40px;
}

.carousel__button img {
  width: 20px;
}

.carousel__nav {
  display: flex;
  justify-content: center;
  padding: 10px 0;
  margin-bottom: 10px;
  position: relative;
  z-index: 3;
}

.carousel__indicator {
  border: 0;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  background: rgba(0, 0, 0, .3);
  margin: 0 10px;
  cursor: pointer;
}

.carousel__indicator.current-slide {
  background: rgba(0, 0, 0, .75);
}

.is-hidden {
  display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<main>
  <!--      Carosel-->
  <div>
    <div class="carousel">


      <button class="carousel__button carousel__button--left is-hidden">
              <img src="Image/left-arrow-svgrepo-com.svg" alt="">
          </button>

      <div class="carousel__track-container">
        <ul class="carousel__track">

          <li class="carousel__slide current-slide">
            <img class="carousel__image" src="Image/campbell-3ZUsNJhi_Ik-unsplash.jpg" alt="">
          </li>

          <li class="carousel__slide">
            <img class="carousel__image" src="Image/marc-kleen-8hU6vtwY8l8-unsplash.jpg" alt="">
          </li>

          <li class="carousel__slide">
            <img class="carousel__image" src="Image/marc-kleen-C9j8S_tIFLU-unsplash.jpg" alt="">
          </li>

        </ul>
      </div>

      <button class="carousel__button carousel__button--right">
              <img src="Image/right-chevron-svgrepo-com.svg" alt="">
          </button>

      <div class="carousel__nav">
        <button class="carousel__indicator current-slide"></button>
        <button class="carousel__indicator"></button>
        <button class="carousel__indicator"></button>
      </div>
    </div>
  </div>

  <section>
    <div></div>
    <div></div>
    <div></div>
  </section>
  <section>
    <div></div>
    <div></div>
  </section>
  <div>
    <h3 id="happy">Happy Clients</h3>
    <div></div>
    <div></div>
    <div></div>
  </div>
</main>

Your code seems functional, but I think adjusting the z-index for your navigation might provide better results

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 incorporate an options tabbed menu into a mega drop-down menu?

I came across a useful code snippet on The code snippet offers users a choice of 3 options with tabbed menus. Take a look at the website to see how this tabbed menu functions. Here is the code for this snippet <div class="row-fluid"> <div ...

Is it possible to have the cells in a grid adjust and fill the available space when the size of the grid changes?

Hey there! I'm currently working on creating a dynamic grid but I'm facing an issue with making the cells fill the space between them when the size of the grid changes. Within my function that generates the grid, I take in the size as a paramete ...

Switch the background color alternately from red to green every second

Need help with a webpage that changes the background color every second using JavaScript. The issue lies in figuring out how to correctly change the variable within the function. Here's an example of the code: <!DOCTYPE html> <html> ...

What is the best way to display the letter X (Clear) in the Chrome INPUT field with the type

A custom application was developed that utilizes an input field of the number type: <input type="number" min="-1000000" max="1000000" step="0.01"> Within Internet Explorer, there is a small "clear" or [X] button on the right side of the input field ...

Navigating Websites in Google Search

Whenever I search for keywords related to my website on Google, the search results show my website's content and address. However, when I click on the link, it redirects me to a different unrelated website. Click here to view an image ...

The header does not extend fully to the top edge

I am attempting to relocate the header to the topmost position on my webpage. However, despite my efforts, it remains in its current position. You can view an example of the issue in this fiddle http://jsfiddle.net/DCtH7/4/ Upon examining the fiddle, you ...

Mosaic-inspired image gallery with HTML and CSS styling

Can anyone help me create a couple of styled "blocks" in HTML and CSS similar to the design shown in the image? I've searched for templates but can't find anything that matches my vision, so any assistance would be appreciated. (links not require ...

Tips for invoking a JavaScript class method from an HTML document

I've created a Typescript class that dynamically inserts an HTML element to a page after it's loaded. Here is the code snippet: const calcElement: string = ` <div class="container"> <span class="cc-title">Field</span> ...

The challenge of stacking elements using Div and a Jquery slider

I am facing an issue with the z-index on my website. The photo slider I implemented at the top seems to be causing the drop-down menu for administration to be hidden behind it. I have attempted to adjust the z-index of different divs, but so far, my chan ...

What's the issue with my ExpressJS req.query not functioning as expected?

My NodeJS repl setup includes an input, button, and h1 element. The goal is to update the HTML inside the h1 element with the value of the input upon button click. Here's a glimpse of my code: index.js: const Database = require("@replit/database ...

Tips for avoiding a button reverting to its original state upon page refresh

I have a button with the ID #first that, when clicked, is replaced by another button with the ID #second. However, if I refresh the page after clicking on the second button, it goes back to displaying the first button. Is there a way to make sure that th ...

What is the best way to incorporate the animated link hover effect I have implemented, in combination with Bootstrap's stretched link feature?

Recently, I encountered a dilemma while enhancing the hover state of a link by adding an animated underline to it. My approach involved using absolute position in the CSS, specifically setting bottom: 0; in the ::after pseudo class. However, another requ ...

What is the best way to connect added elements together?

I am currently utilizing Plupload to upload files. Due to specific requirements, I need to place FilesAdded "inside" init as demonstrated below. The issue I'm facing is the inability to utilize jQuery.remove() on elements that have been appended usin ...

The background of the ACTK Modal Popup vanishes after multiple instances of scrolling up and down

The issue I'm facing is with the AJAX Control ToolKit Modal Popup's background (the blind curtain) disappearing after scrolling up and down several times. I have attempted to resolve this by applying various CSS styles, but unfortunately, none of ...

What could be the reason behind Flex making several images decrease in size?

I'm trying to set up a carousel of images with Tailwind CSS, where 5 identically sized images are displayed next to each other and can be scrolled left and right. When I imported the images without using Flex, they fit the max-width that I had specifi ...

What is the best way to keep the heights of two divs in sync?

Is there a way to make two divs have the same height, even though their content determines their individual heights? I am looking for a solution that doesn't involve using a table or a parent div. I'm new to JavaScript, so I'm hoping there i ...

Exploring the integration of PostgreSQL into JavaScript

As a beginner in JavaScript, I am looking to create a web page that can store data in a database. Can anyone provide guidance on what resources or materials I should study to learn more about this process? ...

Is it possible to update the background image of my iframe video?

I'm looking to customize the play button on a video displayed through an iframe on my website. Here is the code snippet I've been working with: .ytp-cued-thumbnail-overlay-image { background: url(https://www.example.com/images/video-play-butt ...

How to manage the onClick event in HTML while the page is still loading?

When I try to call the Javascript function from the HTML onClick event, everything works smoothly if the page is already loaded. However, if I click the button before the document is ready, I encounter an undefined function error in the console. <a oncl ...

Switching between jQuery toggleclass and a button action to a Checkbox action

Hey there! I am currently working with code in Wordpress using the DIVI theme builder. I am still new to JS and jQuery, so bear with me. I recently found a cool Night Mode feature that activates when a button is clicked. I stumbled upon a custom toggle swi ...