Эффект размытия при наведении + описание для изображений на чистом CSS3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
.container { position: relative; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; align-items: center; width: 33.33333333%; height: 50vh; overflow: hidden; background: #000; } .container:hover h1 { opacity: 1; -webkit-transform: translateY(0px); transform: translateY(0px); } .container:hover .photo { -webkit-filter: grayscale(80%) blur(8px); filter: grayscale(80%) blur(8px); } .container h1 { position: relative; opacity: 0; -webkit-transform: translateY(40px); transform: translateY(40px); -webkit-transition: opacity 0.4s, -webkit-transform 0.4s; transition: opacity 0.4s, -webkit-transform 0.4s; transition: opacity 0.4s, transform 0.4s; transition: opacity 0.4s, transform 0.4s, -webkit-transform 0.4s; color: #fff; text-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5); } .container .photo { position: absolute; top: -1rem; left: -1rem; right: -1rem; bottom: -1rem; background-size: cover; background-position: center center; background-repeat: no-repeat; -webkit-filter: grayscale(80%) blur(0px); filter: grayscale(80%) blur(0px); -webkit-transition: -webkit-filter 0.4s ease-out; transition: -webkit-filter 0.4s ease-out; transition: filter 0.4s ease-out; transition: filter 0.4s ease-out, -webkit-filter 0.4s ease-out; } .container .photo.photo1, .container .photo.photo5 { background-image: url("/img/photo-1.jpg"); } .container .photo.photo2, .container .photo.photo6 { background-image: url("/img/photo-2.jpg"); } .container .photo.photo3, .container .photo.photo4 { background-image: url("/img/photo-3.jpg"); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<div class="container"> <div class="photo photo1"></div> <h1>Hello Dev</h1> </div> <div class="container"> <div class="photo photo2"></div> <h1>Hello Dev</h1> </div> <div class="container"> <div class="photo photo3"></div> <h1>Hello Dev</h1> </div> |