Стильный эффект при наведении на картинки при помощи 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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
.snip { background-color: #fff; color: #ffffff; display: inline-block; font-size: 16px; margin: 10px 5px; max-width: 315px; min-width: 230px; overflow: hidden; position: relative; text-align: left; width: 100%; -webkit-transform: translateZ(0); transform: translateZ(0); } .snip *, .snip *:before, .snip *:after { -webkit-box-sizing: border-box; box-sizing: border-box; -webkit-transition: all 0.45s ease; transition: all 0.45s ease; } .snip img { backface-visibility: hidden; max-width: 100%; vertical-align: top; } .snip:before, .snip:after { position: absolute; top: 0; bottom: 0; left: 0; right: 0; content: ''; background-color: #b81212; opacity: 0.5; -webkit-transition: all 0.45s ease; transition: all 0.45s ease; } .snip:before { -webkit-transform: skew(30deg) translateX(-80%); transform: skew(30deg) translateX(-80%); } .snip:after { -webkit-transform: skew(-30deg) translateX(-70%); transform: skew(-30deg) translateX(-70%); } .snip figcaption { position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; z-index: 1; bottom: 0; padding: 25px 40% 25px 20px; } .snip figcaption:before, .snip figcaption:after { position: absolute; top: 0; bottom: 0; left: 0; right: 0; background-color: #b81212; box-shadow: 0 0 20px rgba(0, 0, 0, 0.7); content: ''; opacity: 0.5; z-index: -1; } .snip figcaption:before { -webkit-transform: skew(30deg) translateX(-100%); transform: skew(30deg) translateX(-100%); } .snip figcaption:after { -webkit-transform: skew(-30deg) translateX(-90%); transform: skew(-30deg) translateX(-90%); } .snip h3, .snip p { margin: 0; opacity: 0; letter-spacing: 1px; } .snip h3 { font-size: 20px; font-weight: 700; line-height: 1em; text-transform: uppercase; width: 180px; } .snip p { font-size: 0.9em; } .snip a { position: absolute; top: 0; bottom: 0; left: 0; right: 0; z-index: 1; } .snip:hover h3, .snip.hover h3, .snip:hover p, .snip.hover p { -webkit-transform: translateY(0); transform: translateY(0); opacity: 0.9; -webkit-transition-delay: 0.2s; transition-delay: 0.2s; } .snip:hover:before, .snip.hover:before { -webkit-transform: skew(30deg) translateX(-20%); transform: skew(30deg) translateX(-20%); -webkit-transition-delay: 0.05s; transition-delay: 0.05s; } .snip:hover:after, .snip.hover:after { -webkit-transform: skew(-30deg) translateX(-10%); transform: skew(-30deg) translateX(-10%); } .snip:hover figcaption:before, .snip.hover figcaption:before { -webkit-transform: skew(30deg) translateX(-40%); transform: skew(30deg) translateX(-40%); -webkit-transition-delay: 0.15s; transition-delay: 0.15s; } .snip:hover figcaption:after, .snip.hover figcaption:after { -webkit-transform: skew(-30deg) translateX(-30%); transform: skew(-30deg) translateX(-30%); -webkit-transition-delay: 0.1s; transition-delay: 0.1s; } /* Demo purposes only */ body { background-color: #212121; text-align: center; } |
1 2 3 4 5 6 7 8 |
<figure class="snip"> <img src="ССЫЛКА_НА_КАРТИНКУ" /> <figcaption> <h3>Я - заголовок</h3> <p>Я - краткое описание к картинке</p> </figcaption> <a href="#"></a> </figure> |