Pure CSS3 blind-style switching carousel effect
Brief Tutorial
This is a blind-style switching carousel special effect made using pure CSS3. This special effect is made using background images. When the carousel is switched, a set of div elements are used to create the blinds effect, which is very cool.
How to use
HTML structure
The carousel effect uses 6 background images. The HTML structure is as follows:
<div class="slider"> <div class="captions"> <div class="c1">duzy fiat</div> <div class="c2">syrenka</div> <div class="c3">wartburg</div> <div class="c4">warszawa</div> <div class="c5">wolga</div> <div class="c6">polonez</div> </div> <div class="img img1"> <div class="frag frag1"></div> <div class="frag frag2"></div> <div class="frag frag3"></div> <div class="frag frag4"></div> <div class="frag frag5"></div> <div class="frag frag6"></div> </div> <div class="img img2"> <div class="frag frag1"></div> <div class="frag frag2"></div> <div class="frag frag3"></div> <div class="frag frag4"></div> <div class="frag frag5"></div> <div class="frag frag6"></div> </div> <div class="img img3"> <div class="frag frag1"></div> <div class="frag frag2"></div> <div class="frag frag3"></div> <div class="frag frag4"></div> <div class="frag frag5"></div> <div class="frag frag6"></div> </div> <div class="img img4"> <div class="frag frag1"></div> <div class="frag frag2"></div> <div class="frag frag3"></div> <div class="frag frag4"></div> <div class="frag frag5"></div> <div class="frag frag6"></div> </div> <div class="img img5"> <div class="frag frag1"></div> <div class="frag frag2"></div> <div class="frag frag3"></div> <div class="frag frag4"></div> <div class="frag frag5"></div> <div class="frag frag6"></div> </div> <div class="img img6"> <div class="frag frag1"></div> <div class="frag frag2"></div> <div class="frag frag3"></div> <div class="frag frag4"></div> <div class="frag frag5"></div> <div class="frag frag6"></div> </div> </div>
Another 6 are used The Radio button serves as a switching button for the carousel:
<input type="radio" name="slides" id="slide1" checked> <input type="radio" name="slides" id="slide2"> <input type="radio" name="slides" id="slide3"> <input type="radio" name="slides" id="slide4"> <input type="radio" name="slides" id="slide5"> <input type="radio" name="slides" id="slide6">
CSS style
The basic CSS style of the carousel is as follows:
.slider, .img { width: inherit; height: inherit; } .slider { position: relative; overflow: hidden; background-color: #000; border: 8px solid #eee; border-radius: 5px; box-shadow: 0 7px 20px rgba(0,0,0,.5); } .img { position: absolute; margin-left: -8px; perspective: 500px; } .frag { width: 150px; height: inherit; float: left; opacity: 0; z-index: 0; transform-origin: center right; transform: rotateY(90deg) translateZ(100px) scale(1.5); transition: transform .6s, opacity .6s, -webkit-filter 2s ease-out; -webkit-filter: saturate(0) blur(10px) brightness(.6) contrast(4); } .img .frag2 { background-position: -150px 0; transition-delay: .2s; } .img .frag3 { background-position: -300px 0; transition-delay: .4s; } .img .frag4 { background-position: -450px 0; transition-delay: .6s; } .img .frag5 { background-position: -600px 0; transition-delay: .8s; } .img .frag6 { background-position: -750px 0; transition-delay: 1s; }
Background image style used in the carousel As follows:
.img1 .frag { background-image: url(1.jpg) } .img2 .frag { background-image: url(2.jpg) } .img3 .frag { background-image: url(3.jpg) } .img4 .frag { background-image: url(4.jpg) } .img5 .frag { background-image: url(5.jpg) } .img6 .frag { background-image: url(6.jpg) }
The CSS style of the carousel image control button is as follows:
#slide1:checked ~ .slider .img1 .frag, #slide2:checked ~ .slider .img2 .frag, #slide3:checked ~ .slider .img3 .frag, #slide4:checked ~ .slider .img4 .frag, #slide5:checked ~ .slider .img5 .frag, #slide6:checked ~ .slider .img6 .frag { transform: rotateY(0) translateZ(0) scale(1); -webkit-filter: saturate(1) blur(0) brightness(1) contrast(1); opacity: 1; z-index: 1; } .controls { position: absolute; bottom: -50px; left: 50%; margin-left: -115px; /*(6elem30px+5el10px)/2=115px*/ } .controls label { display: block; height: 10px; width: 30px; float: left; background-color: #000; margin-right: 10px; cursor: pointer; opacity: .2; transition: opacity .5s; } .controls label:hover, .side-controls label:hover, #slide1:checked ~ .controls label:nth-of-type(1), #slide2:checked ~ .controls label:nth-of-type(2), #slide3:checked ~ .controls label:nth-of-type(3), #slide4:checked ~ .controls label:nth-of-type(4), #slide5:checked ~ .controls label:nth-of-type(5), #slide6:checked ~ .controls label:nth-of-type(6) { opacity: .8; } .side-controls label { position: absolute; display: block; border-top: 30px solid transparent; border-bottom: 30px solid transparent; top: 50%; margin-top: -15px; cursor: pointer; opacity: .2; transition: opacity .5s; } #slide1:checked ~ .side-controls label:nth-of-type(6), #slide2:checked ~ .side-controls label:nth-of-type(1), #slide3:checked ~ .side-controls label:nth-of-type(2), #slide4:checked ~ .side-controls label:nth-of-type(3), #slide5:checked ~ .side-controls label:nth-of-type(4), #slide6:checked ~ .side-controls label:nth-of-type(5) { left: -40px; border-right: 40px solid #000; } #slide1:checked ~ .side-controls label:nth-of-type(2), #slide2:checked ~ .side-controls label:nth-of-type(3), #slide3:checked ~ .side-controls label:nth-of-type(4), #slide4:checked ~ .side-controls label:nth-of-type(5), #slide5:checked ~ .side-controls label:nth-of-type(6), #slide6:checked ~ .side-controls label:nth-of-type(1) { right: -40px; border-left: 40px solid #000; } #slide2:checked ~ .slider .captions .c2, #slide1:checked ~ .slider .captions .c1, #slide3:checked ~ .slider .captions .c3, #slide4:checked ~ .slider .captions .c4, #slide5:checked ~ .slider .captions .c5, #slide6:checked ~ .slider .captions .c6 { text-shadow: 0 0 0 rgba(255,255,255,.9) }
Finally set the CSS style for the image title:
.captions > div { position: absolute; right: 20px; bottom: 7px; color: transparent; text-shadow: 0 0 60px transparent; font-size: 3em; z-index: 1; text-transform: uppercase; transition: text-shadow 2s; }
The above is a pure CSS3 blind-style switching carousel The content of picture special effects. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to achieve wave effect with pure CSS3? This article will introduce to you how to use SVG and CSS animation to create wave effects. I hope it will be helpful to you!

This article will show you how to use CSS to easily realize various weird-shaped buttons that appear frequently. I hope it will be helpful to you!

Two methods: 1. Using the display attribute, just add the "display:none;" style to the element. 2. Use the position and top attributes to set the absolute positioning of the element to hide the element. Just add the "position:absolute;top:-9999px;" style to the element.

In CSS, you can use the border-image attribute to achieve a lace border. The border-image attribute can use images to create borders, that is, add a background image to the border. You only need to specify the background image as a lace style; the syntax "border-image: url (image path) offsets the image border width inward. Whether outset is repeated;".

Use the WeChat applet to achieve the carousel switching effect. The WeChat applet is a lightweight application that is simple and efficient to develop and use. In WeChat mini programs, it is a common requirement to achieve carousel switching effects. This article will introduce how to use the WeChat applet to achieve the carousel switching effect, and give specific code examples. First, add a carousel component to the page file of the WeChat applet. For example, you can use the <swiper> tag to achieve the switching effect of the carousel. In this component, you can pass b

Implementation method: 1. Use the ":active" selector to select the state of the mouse click on the picture; 2. Use the transform attribute and scale() function to achieve the picture magnification effect, the syntax "img:active {transform: scale(x-axis magnification, y Axis magnification);}".

How to create text carousel and image carousel? The first thing everyone thinks of is whether to use js. In fact, text carousel and image carousel can also be realized using pure CSS. Let’s take a look at the implementation method. I hope it will be helpful to everyone!

How does JavaScript implement the automatic play function of carousel images? With the rapid development of the Internet, carousel images have become one of the commonly used elements in web design. Carousel pictures can not only display multiple pictures to users, but also improve user experience through the automatic playback function. JavaScript is one of the important tools for realizing the automatic playback function of carousels. This article will introduce how JavaScript implements the automatic playback function of carousel images, and provide corresponding code examples. First, we need to prepare some basic
