Search code examples
htmlcsscarouselslideshow

More than 1 Slideshow on the same HTML Page


I have three slideshows in the same HTML page, the first two work fine but the third not, its images doesn't slide properly.

body {
  background-color: #000000;
}

.carousel > input[type="radio"]:nth-child(1):checked ~ .carousel__prev > label:nth-child(4),
.carousel > input[type="radio"]:nth-child(1):checked ~ .carousel__next > label:nth-child(2),
.carousel > input[type="radio"]:nth-child(2):checked ~ .carousel__prev > label:nth-child(1),
.carousel > input[type="radio"]:nth-child(2):checked ~ .carousel__next > label:nth-child(3),
.carousel > input[type="radio"]:nth-child(3):checked ~ .carousel__prev > label:nth-child(2),
.carousel > input[type="radio"]:nth-child(3):checked ~ .carousel__next > label:nth-child(4),
.carousel > input[type="radio"]:nth-child(4):checked ~ .carousel__prev > label:nth-child(3),
.carousel > input[type="radio"]:nth-child(4):checked ~ .carousel__next > label:nth-child(1),
.carousel-2 > input[type="radio"]:nth-child(1):checked ~ .carousel__prev-2 > label:nth-child(4),
.carousel-2 > input[type="radio"]:nth-child(1):checked ~ .carousel__next-2 > label:nth-child(2),
.carousel-2 > input[type="radio"]:nth-child(2):checked ~ .carousel__prev-2 > label:nth-child(1),
.carousel-2 > input[type="radio"]:nth-child(2):checked ~ .carousel__next-2 > label:nth-child(3),
.carousel-2 > input[type="radio"]:nth-child(3):checked ~ .carousel__prev-2 > label:nth-child(2),
.carousel-2 > input[type="radio"]:nth-child(3):checked ~ .carousel__next-2 > label:nth-child(4),
.carousel-2 > input[type="radio"]:nth-child(4):checked ~ .carousel__prev-2 > label:nth-child(3),
.carousel-2 > input[type="radio"]:nth-child(4):checked ~ .carousel__next-2 > label:nth-child(1),
.carousel-3 > input[type="radio"]:nth-child(1):checked ~ .carousel__prev-3 > label:nth-child(4),
.carousel-3 > input[type="radio"]:nth-child(1):checked ~ .carousel__prev-3 > label:nth-child(2),
.carousel-3 > input[type="radio"]:nth-child(2):checked ~ .carousel__prev-3 > label:nth-child(1),
.carousel-3 > input[type="radio"]:nth-child(2):checked ~ .carousel__prev-3 > label:nth-child(3),
.carousel-3 > input[type="radio"]:nth-child(3):checked ~ .carousel__prev-3 > label:nth-child(2),
.carousel-3 > input[type="radio"]:nth-child(3):checked ~ .carousel__prev-3 > label:nth-child(4),
.carousel-3 > input[type="radio"]:nth-child(4):checked ~ .carousel__prev-3 > label:nth-child(3),
.carousel-3 > input[type="radio"]:nth-child(4):checked ~ .carousel__prev-3 > label:nth-child(1) {
  opacity: 1 !important;
  z-index: 3;
}

*, *:before, *:after {
  box-sizing: border-box;
}

.container,
.container-2,
.container-3 {
  width: 100%;
  margin: 0 0 10px 0;
}

.carousel,
.carousel-2,
.carousel-3 {
  width: 100%;
  height: 300px;
  position: relative;
  overflow: hidden;
}

.carousel > input[type="radio"],
.carousel-2 > input[type="radio"],
.carousel-3 > input[type="radio"] {
  position: absolute;
  left: 0;
  opacity: 0;
  top: 0;
}

.carousel > input[type="radio"]:checked ~ .carousel__items .carousel__item,
.carousel > input[type="radio"]:checked ~ .carousel__prev > label,
.carousel > input[type="radio"]:checked ~ .carousel__next > label,
.carousel-2 > input[type="radio"]:checked ~ .carousel__items-2 .carousel__item-2,
.carousel-2 > input[type="radio"]:checked ~ .carousel__prev-2 > label,
.carousel-2 > input[type="radio"]:checked ~ .carousel__next-2 > label,
.carousel-3 > input[type="radio"]:checked ~ .carousel__items-3 .carousel__item-3,
.carousel-3 > input[type="radio"]:checked ~ .carousel__prev-3 > label,
.carousel-3 > input[type="radio"]:checked ~ .carousel__next-3 > label {
  opacity: 0;
}

.carousel > input[type="radio"]:nth-child(1):checked ~ .carousel__items .carousel__item:nth-child(1),
.carousel-2 > input[type="radio"]:nth-child(1):checked ~ .carousel__items-2 .carousel__item-2:nth-child(1),
.carousel-3 > input[type="radio"]:nth-child(1):checked ~ .carousel__items-3 .carousel__item-3:nth-child(1) {
  opacity: 1;
}

.carousel > input[type="radio"]:nth-child(1):checked ~ .carousel__nav > label:nth-child(1),
.carousel-2 > input[type="radio"]:nth-child(1):checked ~ .carousel__nav-2 > label:nth-child(1),
.carousel-3 > input[type="radio"]:nth-child(1):checked ~ .carousel__nav-3 > label:nth-child(1) {
  background: #ccc;
  cursor: default;
  pointer-events: none;
}

.carousel > input[type="radio"]:nth-child(2):checked ~ .carousel__items .carousel__item:nth-child(2),
.carousel-2 > input[type="radio"]:nth-child(2):checked ~ .carousel__items-2 .carousel__item-2:nth-child(2),
.carousel-3 > input[type="radio"]:nth-child(2):checked ~ .carousel__items-3 .carousel__item-3:nth-child(2) {
  opacity: 1;
}

.carousel > input[type="radio"]:nth-child(2):checked ~ .carousel__nav > label:nth-child(2),
.carousel-2 > input[type="radio"]:nth-child(2):checked ~ .carousel__nav-2 > label:nth-child(2),
.carousel-3 > input[type="radio"]:nth-child(2):checked ~ .carousel__nav-3 > label:nth-child(2) {
  background: #ccc;
  cursor: default;
  pointer-events: none;
}

.carousel > input[type="radio"]:nth-child(3):checked ~ .carousel__items .carousel__item:nth-child(3),
.carousel-2 > input[type="radio"]:nth-child(3):checked ~ .carousel__items-2 .carousel__item-2:nth-child(3),
.carousel-3 > input[type="radio"]:nth-child(3):checked ~ .carousel__items-3 .carousel__item-3:nth-child(3) {
  opacity: 1;
}

.carousel > input[type="radio"]:nth-child(3):checked ~ .carousel__nav > label:nth-child(3),
.carousel-2 > input[type="radio"]:nth-child(3):checked ~ .carousel__nav-2 > label:nth-child(3),
.carousel-3 > input[type="radio"]:nth-child(3):checked ~ .carousel__nav-3 > label:nth-child(3) {
  background: #ccc;
  cursor: default;
  pointer-events: none;
}

.carousel > input[type="radio"]:nth-child(4):checked ~ .carousel__items .carousel__item:nth-child(4),
.carousel-2 > input[type="radio"]:nth-child(4):checked ~ .carousel__items-2 .carousel__item-2:nth-child(4),
.carousel-3 > input[type="radio"]:nth-child(4):checked ~ .carousel__items-3 .carousel__item-3:nth-child(4) {
  opacity: 1;
}

.carousel > input[type="radio"]:nth-child(4):checked ~ .carousel__nav > label:nth-child(4),
.carousel-2 > input[type="radio"]:nth-child(4):checked ~ .carousel__nav-2 > label:nth-child(4),
.carousel-3 > input[type="radio"]:nth-child(4):checked ~ .carousel__nav-3 > label:nth-child(4) {
  background: #ccc;
  cursor: default;
  pointer-events: none;
}

.carousel__items,
.carousel__items-2,
.carousel__items-3 {
  margin: 0;
  padding: 0;
  list-style-type: none;
  width: 100%;
  height: 600px;
  position: relative;
}

.carousel__item,
.carousel__item-2,
.carousel__item-3 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  transition: opacity 2s;
}

.carousel__item img,
.carousel__item-2 img,
.carousel__item-3 img {
  width: 100%;
  height: 300px;
  vertical-align: middle;
}

.carousel__item .caption,
.carousel__item-2 .caption-2,
.carousel__item-3 .caption-3 {
  position: absolute;
  width: 100%;
  top: 43.4%;
  left: 0;
  margin: 0;
  padding: 5px 0 15px 0;
  background-color: rgba(242,242,242,.6);
  color: #FFFFFF;
  text-align: center;
}

.carousel__prev > label,
.carousel__next > label,
.carousel__prev-2 > label,
.carousel__next-2 > label,
.carousel__prev-3 > label,
.carousel__next-3 > label {
  background-color: rgba(242,242,242,.3);
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  display: block;
  width: 60px;
  height: 60px;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: background-color 1s;
  opacity: 0;
  z-index: 2;
}

.carousel__next > label,
.carousel__next-2 > label,
.carousel__next-3 > label {
  border-radius: 5px 0 0 5px;
}

.carousel__prev > label:hover,
.carousel__prev > label:focus,
.carousel__next > label:hover,
.carousel__next > label:focus,
.carousel__prev-2 > label:hover,
.carousel__prev-2 > label:focus,
.carousel__next-2 > label:hover,
.carousel__next-2 > label:focus,
.carousel__prev-3 > label:hover,
.carousel__prev-3 > label:focus,
.carousel__next-3 > label:hover,
.carousel__next-3 > label:focus {
  background-color: rgba(242,242,242,.1);
  opacity: .5 !important;
}

.carousel__prev > label:before,
.carousel__prev > label:after,
.carousel__next > label:before,
.carousel__next > label:after,
.carousel__prev-2 > label:before,
.carousel__prev-2 > label:after,
.carousel__next-2 > label:before,
.carousel__next-2 > label:after,
.carousel__prev-3 > label:before,
.carousel__prev-3 > label:after,
.carousel__next-3 > label:before,
.carousel__next-3 > label:after {
  content: "";
  position: absolute;
  width: inherit;
  height: inherit;
}

.carousel__prev > label:before,
.carousel__next > label:before,
.carousel__prev-2 > label:before,
.carousel__next-2 > label:before,
.carousel__prev-3 > label:before,
.carousel__next-3 > label:before {
  background: linear-gradient(to top, rgba(255,255,255,.6) 0%, rgba(255,255,255,.6) 10%, rgba(51, 51, 51,0) 10%), linear-gradient(to left, rgba(255,255,255,.6) 0%, rgba(255,255,255,.6) 10%, rgba(51, 51, 51,0) 10%);
  width: 50%;
  height: 50%;
  top: 20%;
  transition: background 1s;
}

.carousel__prev > label,
.carousel__prev-2 > label,
.carousel__prev-3 > label {
  left: 0;
}

.carousel__prev > label:before,
.carousel__prev-2 > label:before,
.carousel__prev-3 > label:before {
  left: 35%;
  top: 25%;
  transform: rotate(135deg);
}

.carousel__next > label,
.carousel__next-2 > label,
.carousel__next-3 > label {
  right: 0;
}

.carousel__next > label:before,
.carousel__next-2 > label:before,
.carousel__next-3 > label:before {
  left: 10%;
  top: 25%;
  transform: rotate(315deg);
}
<div class="container">
  <div class="carousel">
    <input type="radio" id="carousel-1" name="carousel" checked>
    <input type="radio" id="carousel-2" name="carousel">
    <input type="radio" id="carousel-3" name="carousel">
    <input type="radio" id="carousel-4" name="carousel">

    <ul class="carousel__items">
      <li class="carousel__item"><img src="https://i.imgur.com/W5E69l9.jpg" alt="">
        <span class="caption">Passignano Sul Trasimeno</span></li>
      <li class="carousel__item"><img src="https://i.imgur.com/eGbNeOB.jpg" alt="">
        <span class="caption">Castello del Leone, Castiglione del Lago</span></li>
      <li class="carousel__item"><img src="https://i.imgur.com/hp2OiNB.jpg" alt="">
        <span class="caption">Castello Borgia, Passignano sul Trasimeno</span></li>
      <li class="carousel__item"><img src="https://i.imgur.com/MHZj0eb.jpg" alt="">
        <span class="caption">Castello Borgia, Passignano sul Trasimeno</span></li>
    </ul>

    <div class="carousel__prev">
      <label for="carousel-1"></label>
      <label for="carousel-2"></label>
      <label for="carousel-3"></label>
      <label for="carousel-4"></label>
    </div>
    <div class="carousel__next">
      <label for="carousel-1"></label>
      <label for="carousel-2"></label>
      <label for="carousel-3"></label>
      <label for="carousel-4"></label>
    </div>
  </div>
</div>

<div class="container-2">
  <div class="carousel-2">
    <input type="radio" id="carousel-1-2" name="carousel-2" checked>
    <input type="radio" id="carousel-2-2" name="carousel-2">
    <input type="radio" id="carousel-3-2" name="carousel-2">
    <input type="radio" id="carousel-4-2" name="carousel-2">

    <ul class="carousel__items-2">
      <li class="carousel__item-2"><img src="https://i.imgur.com/S12ZVXY.jpg" alt="">
        <span class="caption-2">Lago di Piediluco</span></li>
      <li class="carousel__item-2"><img src="https://i.imgur.com/3JcEZp7.jpg" alt="">
        <span class="caption-2">Lago di Piediluco</span></li>
      <li class="carousel__item-2"><img src="https://i.imgur.com/kayLkDW.jpg" alt="">
        <span class="caption-2">Lago di Piediluco</span></li>
      <li class="carousel__item-2"><img src="https://i.imgur.com/gfRwbU2.jpg" alt="">
        <span class="caption-2">Lago di Piediluco</span></li>
    </ul>

    <div class="carousel__prev-2">
      <label for="carousel-1-2"></label>
      <label for="carousel-2-2"></label>
      <label for="carousel-3-2"></label>
      <label for="carousel-4-2"></label>
    </div>
    <div class="carousel__next-2">
      <label for="carousel-1-2"></label>
      <label for="carousel-2-2"></label>
      <label for="carousel-3-2"></label>
      <label for="carousel-4-2"></label>
    </div>
  </div>
</div>

<div class="container-3">
  <div class="carousel-3">
    <input type="radio" id="carousel-1-3" name="carousel-3" checked>
    <input type="radio" id="carousel-2-3" name="carousel-3">
    <input type="radio" id="carousel-3-3" name="carousel-3">
    <input type="radio" id="carousel-4-3" name="carousel-3">

    <ul class="carousel__items-3">
      <li class="carousel__item-3"><img src="https://i.imgur.com/W5E69l9.jpg" alt="">
        <span class="caption-3">Lago di Corbara</span></li>
      <li class="carousel__item-3"><img src="https://i.imgur.com/S12ZVXY.jpg" alt="">
        <span class="caption-3">Lago di Corbara</span></li>
      <li class="carousel__item-3"><img src="https://i.imgur.com/gfRwbU2.jpg" alt="">
        <span class="caption-3">Lago di Corbara</span></li>
      <li class="carousel__item-3"><img src="https://i.imgur.com/eGbNeOB.jpg" alt="">
        <span class="caption-3">Lago di Corbara</span></li>
    </ul>

    <div class="carousel__prev-3">
      <label for="carousel-1-3"></label>
      <label for="carousel-2-3"></label>
      <label for="carousel-3-3"></label>
      <label for="carousel-4-3"></label>
    </div>
    <div class="carousel__next-3">
      <label for="carousel-1-3"></label>
      <label for="carousel-2-3"></label>
      <label for="carousel-3-3"></label>
      <label for="carousel-4-3"></label>
    </div>
  </div>
</div>

jsfiddle: https://jsfiddle.net/spf59wdc/22/

Slideshows are made in pure CSS and I have renamed each selector to avoid conflicts, but something is going wrong and I don't know how fix it.


Solution

  • by mistake you have put .carousel__prev-3 instead of .carousel__next-3 in some parts

    body {
      background-color: #000000;
    }
    
    .carousel > input[type="radio"]:nth-child(1):checked ~ .carousel__prev > label:nth-child(4), 
    .carousel > input[type="radio"]:nth-child(1):checked ~ .carousel__next > label:nth-child(2), 
    .carousel > input[type="radio"]:nth-child(2):checked ~ .carousel__prev > label:nth-child(1), 
    .carousel > input[type="radio"]:nth-child(2):checked ~ .carousel__next > label:nth-child(3), 
    .carousel > input[type="radio"]:nth-child(3):checked ~ .carousel__prev > label:nth-child(2), 
    .carousel > input[type="radio"]:nth-child(3):checked ~ .carousel__next > label:nth-child(4), 
    .carousel > input[type="radio"]:nth-child(4):checked ~ .carousel__prev > label:nth-child(3), 
    .carousel > input[type="radio"]:nth-child(4):checked ~ .carousel__next > label:nth-child(1),
    .carousel-2 > input[type="radio"]:nth-child(1):checked ~ .carousel__prev-2 > label:nth-child(4), 
    .carousel-2 > input[type="radio"]:nth-child(1):checked ~ .carousel__next-2 > label:nth-child(2), 
    .carousel-2 > input[type="radio"]:nth-child(2):checked ~ .carousel__prev-2 > label:nth-child(1), 
    .carousel-2 > input[type="radio"]:nth-child(2):checked ~ .carousel__next-2 > label:nth-child(3), 
    .carousel-2 > input[type="radio"]:nth-child(3):checked ~ .carousel__prev-2 > label:nth-child(2), 
    .carousel-2 > input[type="radio"]:nth-child(3):checked ~ .carousel__next-2 > label:nth-child(4), 
    .carousel-2 > input[type="radio"]:nth-child(4):checked ~ .carousel__prev-2 > label:nth-child(3), 
    .carousel-2 > input[type="radio"]:nth-child(4):checked ~ .carousel__next-2 > label:nth-child(1),
    .carousel-3 > input[type="radio"]:nth-child(1):checked ~ .carousel__prev-3 > label:nth-child(4), 
    .carousel-3 > input[type="radio"]:nth-child(1):checked ~ .carousel__next-3 > label:nth-child(2), 
    .carousel-3 > input[type="radio"]:nth-child(2):checked ~ .carousel__prev-3 > label:nth-child(1), 
    .carousel-3 > input[type="radio"]:nth-child(2):checked ~ .carousel__next-3 > label:nth-child(3), 
    .carousel-3 > input[type="radio"]:nth-child(3):checked ~ .carousel__prev-3 > label:nth-child(2), 
    .carousel-3 > input[type="radio"]:nth-child(3):checked ~ .carousel__next-3 > label:nth-child(4), 
    .carousel-3 > input[type="radio"]:nth-child(4):checked ~ .carousel__prev-3 > label:nth-child(3), 
    .carousel-3 > input[type="radio"]:nth-child(4):checked ~ .carousel__next-3 > label:nth-child(1) {
      opacity: 1 !important;
      z-index: 3;
    }
    
    *, *:before, *:after {
      box-sizing: border-box;
    }
    
    .container,
    .container-2,
    .container-3 {
      width: 100%;
      margin: 0 0 10px 0;
    }
    
    .carousel,
    .carousel-2,
    .carousel-3 {
      width: 100%;
      height: 300px;
      position: relative;
      overflow: hidden;
    }
    
    .carousel > input[type="radio"],
    .carousel-2 > input[type="radio"],
    .carousel-3 > input[type="radio"] {
      position: absolute;
      left: 0;
      opacity: 0;
      top: 0;
    }
    
    .carousel > input[type="radio"]:checked ~ .carousel__items .carousel__item, 
    .carousel > input[type="radio"]:checked ~ .carousel__prev > label, 
    .carousel > input[type="radio"]:checked ~ .carousel__next > label,
    .carousel-2 > input[type="radio"]:checked ~ .carousel__items-2 .carousel__item-2, 
    .carousel-2 > input[type="radio"]:checked ~ .carousel__prev-2 > label, 
    .carousel-2 > input[type="radio"]:checked ~ .carousel__next-2 > label,
    .carousel-3 > input[type="radio"]:checked ~ .carousel__items-3 .carousel__item-3, 
    .carousel-3 > input[type="radio"]:checked ~ .carousel__prev-3 > label, 
    .carousel-3 > input[type="radio"]:checked ~ .carousel__next-3 > label {
      opacity: 0;
    }
    
    .carousel > input[type="radio"]:nth-child(1):checked ~ .carousel__items .carousel__item:nth-child(1),
    .carousel-2 > input[type="radio"]:nth-child(1):checked ~ .carousel__items-2 .carousel__item-2:nth-child(1),
    .carousel-3 > input[type="radio"]:nth-child(1):checked ~ .carousel__items-3 .carousel__item-3:nth-child(1) {
      opacity: 1;
    }
    
    .carousel > input[type="radio"]:nth-child(1):checked ~ .carousel__nav > label:nth-child(1),
    .carousel-2 > input[type="radio"]:nth-child(1):checked ~ .carousel__nav-2 > label:nth-child(1),
    .carousel-3 > input[type="radio"]:nth-child(1):checked ~ .carousel__nav-3 > label:nth-child(1) {
      background: #ccc;
      cursor: default;
      pointer-events: none;
    }
    
    .carousel > input[type="radio"]:nth-child(2):checked ~ .carousel__items .carousel__item:nth-child(2),
    .carousel-2 > input[type="radio"]:nth-child(2):checked ~ .carousel__items-2 .carousel__item-2:nth-child(2),
    .carousel-3 > input[type="radio"]:nth-child(2):checked ~ .carousel__items-3 .carousel__item-3:nth-child(2) {
      opacity: 1;
    }
    
    .carousel > input[type="radio"]:nth-child(2):checked ~ .carousel__nav > label:nth-child(2),
    .carousel-2 > input[type="radio"]:nth-child(2):checked ~ .carousel__nav-2 > label:nth-child(2),
    .carousel-3 > input[type="radio"]:nth-child(2):checked ~ .carousel__nav-3 > label:nth-child(2) {
      background: #ccc;
      cursor: default;
      pointer-events: none;
    }
    
    .carousel > input[type="radio"]:nth-child(3):checked ~ .carousel__items .carousel__item:nth-child(3),
    .carousel-2 > input[type="radio"]:nth-child(3):checked ~ .carousel__items-2 .carousel__item-2:nth-child(3),
    .carousel-3 > input[type="radio"]:nth-child(3):checked ~ .carousel__items-3 .carousel__item-3:nth-child(3) {
      opacity: 1;
    }
    
    .carousel > input[type="radio"]:nth-child(3):checked ~ .carousel__nav > label:nth-child(3),
    .carousel-2 > input[type="radio"]:nth-child(3):checked ~ .carousel__nav-2 > label:nth-child(3),
    .carousel-3 > input[type="radio"]:nth-child(3):checked ~ .carousel__nav-3 > label:nth-child(3) {
      background: #ccc;
      cursor: default;
      pointer-events: none;
    }
    
    .carousel > input[type="radio"]:nth-child(4):checked ~ .carousel__items .carousel__item:nth-child(4),
    .carousel-2 > input[type="radio"]:nth-child(4):checked ~ .carousel__items-2 .carousel__item-2:nth-child(4),
    .carousel-3 > input[type="radio"]:nth-child(4):checked ~ .carousel__items-3 .carousel__item-3:nth-child(4) {
      opacity: 1;
    }
    
    .carousel > input[type="radio"]:nth-child(4):checked ~ .carousel__nav > label:nth-child(4),
    .carousel-2 > input[type="radio"]:nth-child(4):checked ~ .carousel__nav-2 > label:nth-child(4),
    .carousel-3 > input[type="radio"]:nth-child(4):checked ~ .carousel__nav-3 > label:nth-child(4) {
      background: #ccc;
      cursor: default;
      pointer-events: none;
    }
    
    .carousel__items,
    .carousel__items-2,
    .carousel__items-3 {
      margin: 0;
      padding: 0;
      list-style-type: none;
      width: 100%;
      height: 600px;
      position: relative;
    }
    
    .carousel__item,
    .carousel__item-2,
    .carousel__item-3 {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 1;
      transition: opacity 2s;
    }
    
    .carousel__item img,
    .carousel__item-2 img,
    .carousel__item-3 img {
      width: 100%;
      height: 300px;
      vertical-align: middle;
    }
    
    .carousel__item .caption,
    .carousel__item-2 .caption-2,
    .carousel__item-3 .caption-3 {
    	position: absolute;
    	width: 100%;
    	top: 43.4%;
    	left: 0;
    	margin: 0;
    	padding: 5px 0 15px 0;
    	background-color: rgba(242,242,242,.6);
    	color: #FFFFFF;
    	text-align: center;
    }
    
    .carousel__prev > label, 
    .carousel__next > label,
    .carousel__prev-2 > label, 
    .carousel__next-2 > label,
    .carousel__prev-3 > label, 
    .carousel__next-3 > label {
      background-color: rgba(242,242,242,.3);
      border-radius: 0 5px 5px 0;
      cursor: pointer;
      display: block;
      width: 60px;
      height: 60px;
      position: absolute;
      top: 50%;
      transform: translateY(-50%);
      transition: background-color 1s;
      opacity: 0;
      z-index: 2;
    }
    
    .carousel__next > label,
    .carousel__next-2 > label,
    .carousel__next-3 > label {
    	border-radius: 5px 0 0 5px;
    }
    
    .carousel__prev > label:hover, 
    .carousel__prev > label:focus, 
    .carousel__next > label:hover, 
    .carousel__next > label:focus,
    .carousel__prev-2 > label:hover, 
    .carousel__prev-2 > label:focus, 
    .carousel__next-2 > label:hover, 
    .carousel__next-2 > label:focus,
    .carousel__prev-3 > label:hover, 
    .carousel__prev-3 > label:focus, 
    .carousel__next-3 > label:hover, 
    .carousel__next-3 > label:focus {
      background-color: rgba(242,242,242,.1);
      opacity: .5 !important;
    }
    
    .carousel__prev > label:before, 
    .carousel__prev > label:after, 
    .carousel__next > label:before, 
    .carousel__next > label:after,
    .carousel__prev-2 > label:before, 
    .carousel__prev-2 > label:after, 
    .carousel__next-2 > label:before, 
    .carousel__next-2 > label:after,
    .carousel__prev-3 > label:before, 
    .carousel__prev-3 > label:after, 
    .carousel__next-3 > label:before, 
    .carousel__next-3 > label:after {
      content: "";
      position: absolute;
      width: inherit;
      height: inherit;
    }
    
    .carousel__prev > label:before, 
    .carousel__next > label:before,
    .carousel__prev-2 > label:before, 
    .carousel__next-2 > label:before,
    .carousel__prev-3 > label:before, 
    .carousel__next-3 > label:before {
      background: linear-gradient(to top, rgba(255,255,255,.6) 0%, rgba(255,255,255,.6) 10%, rgba(51, 51, 51,0) 10%), linear-gradient(to left, rgba(255,255,255,.6) 0%, rgba(255,255,255,.6) 10%, rgba(51, 51, 51,0) 10%);
      width: 50%;
      height: 50%;
      top: 20%;
      transition: background 1s;
    }
    
    .carousel__prev > label,
    .carousel__prev-2 > label,
    .carousel__prev-3 > label {
      left: 0;
    }
    
    .carousel__prev > label:before,
    .carousel__prev-2 > label:before,
    .carousel__prev-3 > label:before {
      left: 35%;
      top: 25%;
      transform: rotate(135deg);
    }
    
    .carousel__next > label,
    .carousel__next-2 > label,
    .carousel__next-3 > label {
      right: 0;
    }
    
    .carousel__next > label:before,
    .carousel__next-2 > label:before,
    .carousel__next-3 > label:before {
      left: 10%;
      top: 25%;
      transform: rotate(315deg);
    }
    <div class="container">
    							<div class="carousel">
    								<input type="radio" id="carousel-1" name="carousel" checked>
    								<input type="radio" id="carousel-2" name="carousel">
    								<input type="radio" id="carousel-3" name="carousel">
    								<input type="radio" id="carousel-4" name="carousel">
    								
    								<ul class="carousel__items">
    									<li class="carousel__item"><img src="https://i.imgur.com/W5E69l9.jpg" alt="">
    									<span class="caption">Passignano Sul Trasimeno</span></li>
    									<li class="carousel__item"><img src="https://i.imgur.com/eGbNeOB.jpg" alt="">
    									<span class="caption">Castello del Leone, Castiglione del Lago</span></li>
    									<li class="carousel__item"><img src="https://i.imgur.com/hp2OiNB.jpg" alt="">
    									<span class="caption">Castello Borgia, Passignano sul Trasimeno</span></li>
    									<li class="carousel__item"><img src="https://i.imgur.com/MHZj0eb.jpg" alt="">
    									<span class="caption">Castello Borgia, Passignano sul Trasimeno</span></li>
    								</ul>
    								
    								<div class="carousel__prev">
    									<label for="carousel-1"></label>
    									<label for="carousel-2"></label>
    									<label for="carousel-3"></label>
    									<label for="carousel-4"></label>
    								</div>
    								<div class="carousel__next">
    									<label for="carousel-1"></label>
    									<label for="carousel-2"></label>
    									<label for="carousel-3"></label>
    									<label for="carousel-4"></label>
    								</div>
    							</div>
    						</div>
                
    <div class="container-2">
    							<div class="carousel-2">
    								<input type="radio" id="carousel-1-2" name="carousel-2" checked>
    								<input type="radio" id="carousel-2-2" name="carousel-2">
    								<input type="radio" id="carousel-3-2" name="carousel-2">
    								<input type="radio" id="carousel-4-2" name="carousel-2">
    								
    								<ul class="carousel__items-2">
    									<li class="carousel__item-2"><img src="https://i.imgur.com/S12ZVXY.jpg" alt="">
    									<span class="caption-2">Lago di Piediluco</span></li>
    									<li class="carousel__item-2"><img src="https://i.imgur.com/3JcEZp7.jpg" alt="">
    									<span class="caption-2">Lago di Piediluco</span></li>
    									<li class="carousel__item-2"><img src="https://i.imgur.com/kayLkDW.jpg" alt="">
    									<span class="caption-2">Lago di Piediluco</span></li>
    									<li class="carousel__item-2"><img src="https://i.imgur.com/gfRwbU2.jpg" alt="">
    									<span class="caption-2">Lago di Piediluco</span></li>
    								</ul>
    								
    								<div class="carousel__prev-2">
    									<label for="carousel-1-2"></label>
    									<label for="carousel-2-2"></label>
    									<label for="carousel-3-2"></label>
    									<label for="carousel-4-2"></label>
    								</div>
    								<div class="carousel__next-2">
    									<label for="carousel-1-2"></label>
    									<label for="carousel-2-2"></label>
    									<label for="carousel-3-2"></label>
    									<label for="carousel-4-2"></label>
    								</div>
    							</div>
    						</div>
                
    <div class="container-3">
    							<div class="carousel-3">
    								<input type="radio" id="carousel-1-3" name="carousel-3" checked>
    								<input type="radio" id="carousel-2-3" name="carousel-3">
    								<input type="radio" id="carousel-3-3" name="carousel-3">
    								<input type="radio" id="carousel-4-3" name="carousel-3">
    								
    								<ul class="carousel__items-3">
    									<li class="carousel__item-3"><img src="https://i.imgur.com/W5E69l9.jpg" alt="">
    									<span class="caption-3">Lago di Corbara</span></li>
    									<li class="carousel__item-3"><img src="https://i.imgur.com/S12ZVXY.jpg" alt="">
    									<span class="caption-3">Lago di Corbara</span></li>
    									<li class="carousel__item-3"><img src="https://i.imgur.com/gfRwbU2.jpg" alt="">
    									<span class="caption-3">Lago di Corbara</span></li>
    									<li class="carousel__item-3"><img src="https://i.imgur.com/eGbNeOB.jpg" alt="">
    									<span class="caption-3">Lago di Corbara</span></li>
    								</ul>
    								
    								<div class="carousel__prev-3">
    									<label for="carousel-1-3"></label>
    									<label for="carousel-2-3"></label>
    									<label for="carousel-3-3"></label>
    									<label for="carousel-4-3"></label>
    								</div>
    								<div class="carousel__next-3">
    									<label for="carousel-1-3"></label>
    									<label for="carousel-2-3"></label>
    									<label for="carousel-3-3"></label>
    									<label for="carousel-4-3"></label>
    								</div>
    							</div>
    						</div>

    https://jsfiddle.net/4vfLbuwe/