DEV Community

Its Aomi
Its Aomi

Posted on

5 1

Simple CSS Carousel

A simple CSS Carousel. For more CSS Carousels visit - xcattx.com

The Html Part

<!DOCTYPE html>
<html lang="en" >
<head>
  <title></title>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
</head>
<body>
  <figure>
<div class="carousel dissolve">
  <div class="items">
      <img class="item" src="https://farm8.staticflickr.com/7020/6767599565_e0ffee2813_d.jpg" alt="">
      <img class="item" src="https://farm8.staticflickr.com/7016/6767598507_21720ed21f_d.jpg" alt="Seven to ten at Leeds &amp; Holbeck">
      <img class="item" src="https://farm8.staticflickr.com/7163/6767596393_8f8b9609ec_d.jpg" alt="Banksy">
      <img class="item" src="https://farm8.staticflickr.com/7004/6767593255_ae68f10fac_d.jpg" alt="Bristol autumn">
   </div>
</div>
</figure>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode

The CSS Part

.dissolve {
  width: 287px;
  height: 430px;
  position: relative;
  overflow: hidden;
}
.dissolve .item {
  position: absolute;
  left: 0;
  right: 0;
  opacity: 0;
  animation: dissolve 8s linear infinite;
}
.dissolve .item:nth-child(2) {
  animation-delay: 2s;
}
.dissolve .item:nth-child(3) {
  animation-delay: 4s;
}
.dissolve .item:nth-child(4) {
  animation-delay: 6s;
}
@-webkit-keyframes dissolve {
  0%,
  30%,
  100% {
    opacity: 0;
  }
  5%,
  25% {
    opacity: 1;
  }
}
@-moz-keyframes dissolve {
  0%,
  30%,
  100% {
    opacity: 0;
  }
  5%,
  25% {
    opacity: 1;
  }
}
@-ms-keyframes dissolve {
  0%,
  30%,
  100% {
    opacity: 0;
  }
  5%,
  25% {
    opacity: 1;
  }
}
@keyframes dissolve {
  0%,
  30%,
  100% {
    opacity: 0;
  }
  5%,
  25% {
    opacity: 1;
  }
}
/* Just a decoration */
@font-face {
  font-family: 'Trykker';
  font-style: normal;
  font-weight: 400;
  src: url(https://fonts.gstatic.com/s/trykker/v21/KtktALyWZJXudUPztN7iPQ.ttf) format('truetype');
}
img {
  max-width: 100%;
  display: block;
}
body {
  font-family: 'Trykker', serif;
  padding: 1em;
  background-color:#000000;
}
figure {
  width: 287px;
  margin: 10px auto 0;
}
figure .carousel {
  width: 287px;
  box-shadow: 0 0 0 10px #fff, 0 0.3em 0.8em 10px black;
}
figure figcaption {
  text-transform: uppercase;
  margin-top: 10px;
  padding-top: 0.5em;
  font-size: 1.2em;
  text-align: center;
  color: #999;
  text-shadow: 0 -0.1em 0 rgba(0, 0, 0, 0.6);
}
figure figcaption:before,
figure figcaption:after {
  content: "\2014";
  font-family: "Times New Roman", serif;
  text-shadow: none;
  color: rgba(255, 255, 255, 0.2);
}
figure figcaption:before {
  margin-right: 0.3em;
}
figure figcaption:after {
  margin-left: 0.3em;
}
figure p {
  color: #999;
  text-align: center;
}
figure p a {
  color: #06afd8;
}
Enter fullscreen mode Exit fullscreen mode

The Output

Image description

Tiugo image

Modular, Fast, and Built for Developers

CKEditor 5 gives you full control over your editing experience. A modular architecture means you get high performance, fewer re-renders and a setup that scales with your needs.

Start now

Top comments (0)

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup πŸš€

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

πŸ‘‹ Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay