Простая карусель CSS

Простая CSS-карусель. Для получения дополнительной информации о CSS-карусели посетите — xcattx.com

Html часть

<!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>
Вход в полноэкранный режим Выход из полноэкранного режима

Часть CSS

.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;
}
Войти в полноэкранный режим Выход из полноэкранного режима

Вывод

Оцените статью
devanswers.ru
Добавить комментарий