간단한 CSS 캐러셀
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 & 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;
}
출력
Reference
이 문제에 관하여(간단한 CSS 캐러셀), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/itsaomi/simple-css-carousel-j12텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)