Пример:
HTML:
Карточка:
1234567891011121314
<div class="atuinCard"> <div class="atuinCard-img"> <img src="photo.jpg" alt="photo"> </div> <div class="atuinCard-content"> <div class="atuinCard-count"></div> <div class="atuinCard-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M400 96a48 48 0 1 0-48-48 48 48 0 0 0 48 48zm-4 121a31.9 31.9 0 0 0 20 7h64a32 32 0 0 0 0-64h-52.78L356 103a31.94 31.94 0 0 0-40.81.68l-112 96a32 32 0 0 0 3.08 50.92L288 305.12V416a32 32 0 0 0 64 0V288a32 32 0 0 0-14.25-26.62l-41.36-27.57 58.25-49.92zm116 39a128 128 0 1 0 128 128 128 128 0 0 0-128-128zm0 192a64 64 0 1 1 64-64 64 64 0 0 1-64 64zM128 256a128 128 0 1 0 128 128 128 128 0 0 0-128-128zm0 192a64 64 0 1 1 64-64 64 64 0 0 1-64 64z"/></svg> </div> <div class="atuinCard-title"><a href="#link">Заголовок карточки</a></div> <p>Контент карточки</p> </div> <a href="#link" class="atuinCard-btn">Подробнее</a></div>
Сетка:
12345678910
<div class="atuinCard-container"> <div class="atuinCard-col"> <!-- Карточка --> </div> <div class="atuinCard-col"> <!-- Карточка --> </div> <!-- ... --> <!-- Еще колонки --> </div>
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<div class="atuinCard"> <div class="atuinCard-img"> <img src="photo.jpg" alt="photo"> </div> <div class="atuinCard-content"> <div class="atuinCard-count"></div> <div class="atuinCard-icon"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><path d="M400 96a48 48 0 1 0-48-48 48 48 0 0 0 48 48zm-4 121a31.9 31.9 0 0 0 20 7h64a32 32 0 0 0 0-64h-52.78L356 103a31.94 31.94 0 0 0-40.81.68l-112 96a32 32 0 0 0 3.08 50.92L288 305.12V416a32 32 0 0 0 64 0V288a32 32 0 0 0-14.25-26.62l-41.36-27.57 58.25-49.92zm116 39a128 128 0 1 0 128 128 128 128 0 0 0-128-128zm0 192a64 64 0 1 1 64-64 64 64 0 0 1-64 64zM128 256a128 128 0 1 0 128 128 128 128 0 0 0-128-128zm0 192a64 64 0 1 1 64-64 64 64 0 0 1-64 64z"/></svg> </div> <div class="atuinCard-title"><a href="#link">Заголовок карточки</a></div> <p>Контент карточки</p> </div> <a href="#link" class="atuinCard-btn">Подробнее</a> </div> |
|
1 2 3 4 5 6 7 8 9 10 |
<div class="atuinCard-container"> <div class="atuinCard-col"> <!-- Карточка --> </div> <div class="atuinCard-col"> <!-- Карточка --> </div> <!-- ... --> <!-- Еще колонки --> </div> |
Если используется своя сетка, родительский элемент для колонок должен иметь стиль counter-reset: count;
CSS:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
/* Сетка */ .atuinCard-container { display: flex; flex-wrap: wrap; justify-content: center; margin: 10px -10px; counter-reset: count;}.atuinCard-container *,.atuinCard-container *::before,.atuinCard-container *::after { box-sizing: border-box;}.atuinCard-col { width: 100%; padding: 10px;}@media (min-width: 576px) { .atuinCard-col { width: 50%; }}@media (min-width: 768px) { .atuinCard-col { width: 50%; }}@media (min-width: 992px) { .atuinCard-col { width: 50%; }}@media (min-width: 1200px) { .atuinCard-col { width: 33.33%; }}@media (min-width: 1400px) { .atuinCard-col { width: 33.33%; }} /* Карточка */.atuinCard { height: 100%; position: relative; border-radius: 10px; overflow: hidden; background-color: #f7f7f7; border: 1px solid #e5e5e5; padding: 16px; transition: all 500ms ease; }.atuinCard:hover { box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); transform: translateY(-10px);}.atuinCard-img { position: relative; display: block; overflow: hidden; border-radius: 10px; z-index: 1; aspect-ratio: 2 / 1;}.atuinCard-img::before { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transition-delay: .1s; transition-timing-function: ease-in-out; transition-duration: .7s; transition-property: all; background: rgba(0, 0, 0, 0.6); opacity: 0; z-index: 1; content: "";}.atuinCard:hover .atuinCard-img::before { opacity: 1;}.atuinCard-img img { width: 100%; height: 100%; object-fit: cover; object-position: center center; border-radius: 10px; transition: .5s ease; transform: scale(1.05);}.atuinCard:hover .atuinCard-img img { transform: scale(1);}.atuinCard-content { position: relative; display: block; margin-top: -40px; margin-bottom: 54px; padding: 0 10px 0;}.atuinCard-content p { font-size: 16px; margin: 0 0 20px;}.atuinCard-count:after { position: absolute; top: 48px; right: 0; font-size: 38px; line-height: 1; font-weight: bold; color: #ddd; counter-increment: count; content: "0"counter(count); transition: all 200ms linear; transition-delay: 0.1s;}.atuinCard:hover .atuinCard-count:after { color: #337AB7;}.atuinCard-icon { position: relative; height: 80px; width: 80px; background-color: #fff; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); display: flex; align-items: center; justify-content: center; transition: all 200ms linear; transition-delay: 0.1s; border-radius: 15px; z-index: 2; transform: scale(0.8);}.atuinCard:hover .atuinCard-icon { background-color: #337AB7;}.atuinCard-icon svg { position: relative; display: inline-block; width: 50px; height: 50px; fill: #337AB7; transition-delay: 0.1s; transition: all 500ms ease;}.atuinCard:hover .atuinCard-icon svg { transform: rotateY(180deg); transition-delay: 0.1s; fill: #fff;}.atuinCard-title { font-size: 20px; line-height: 1.2; margin-top: 10px; margin-bottom: 14px; font-weight: bold;}.atuinCard-title a { color: #000;}.atuinCard-title a:hover { color: #337AB7;}.atuinCard-btn { position: absolute; bottom: 20px; left: 20px; display: inline-flex; align-items: center; justify-content: center; font-weight: bold; font-size: 15px; color: #000; border: 2px solid #ddd; padding: 8px 25px; border-radius: 30px; transition: color 0.5s ease-in-out, border 0.5s 0.2s ease-in-out; text-transform: uppercase; overflow: hidden; z-index: 2; text-align: center;}.atuinCard-btn:hover { color: #fff; border: 2px solid #337AB7;}.atuinCard-btn::before { content: ""; background-color: #337AB7; position: absolute; top: 0; width: 100%; left: 0; right: 0; bottom: 0; clip-path: circle(0% at 50% 50%); transition: all cubic-bezier(0, 0.96, 0.58, 1.1) 0.8s; z-index: -1;}.atuinCard-btn:hover::before { clip-path: circle(100% at 50% 50%); transition: all cubic-bezier(0, 0.96, 0.58, 1.1) 4s; transition-delay: 300ms;}.atuinCard-btn::after { content: ""; background-color: #BFE2FF; position: absolute; top: 0; width: 100%; left: 0; right: 0; bottom: 0; clip-path: circle(0% at 50% 50%); transition: all cubic-bezier(0, 0.96, 0.58, 1.1) 0.8s; z-index: -2;}.atuinCard-btn:hover:after { clip-path: circle(100% at 50% 50%); transition: all cubic-bezier(0, 0.96, 0.58, 1.1) 4s;}@media (min-width: 992px) { .atuinCard-count:after { top: 50px; font-size: 44px; } .atuinCard-icon { transform: scale(1); } .atuinCard-title { margin-top: 20px; } .atuinCard-title { font-size: 22px; } .atuinCard-content p { font-size: 18px; }}
Смотрите также:
|
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 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
/* Сетка */ .atuinCard-container { display: flex; flex-wrap: wrap; justify-content: center; margin: 10px -10px; counter-reset: count; } .atuinCard-container *, .atuinCard-container *::before, .atuinCard-container *::after { box-sizing: border-box; } .atuinCard-col { width: 100%; padding: 10px; } @media (min-width: 576px) { .atuinCard-col { width: 50%; } } @media (min-width: 768px) { .atuinCard-col { width: 50%; } } @media (min-width: 992px) { .atuinCard-col { width: 50%; } } @media (min-width: 1200px) { .atuinCard-col { width: 33.33%; } } @media (min-width: 1400px) { .atuinCard-col { width: 33.33%; } } /* Карточка */ .atuinCard { height: 100%; position: relative; border-radius: 10px; overflow: hidden; background-color: #f7f7f7; border: 1px solid #e5e5e5; padding: 16px; transition: all 500ms ease; } .atuinCard:hover { box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); transform: translateY(-10px); } .atuinCard-img { position: relative; display: block; overflow: hidden; border-radius: 10px; z-index: 1; aspect-ratio: 2 / 1; } .atuinCard-img::before { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transition-delay: .1s; transition-timing-function: ease-in-out; transition-duration: .7s; transition-property: all; background: rgba(0, 0, 0, 0.6); opacity: 0; z-index: 1; content: ""; } .atuinCard:hover .atuinCard-img::before { opacity: 1; } .atuinCard-img img { width: 100%; height: 100%; object-fit: cover; object-position: center center; border-radius: 10px; transition: .5s ease; transform: scale(1.05); } .atuinCard:hover .atuinCard-img img { transform: scale(1); } .atuinCard-content { position: relative; display: block; margin-top: -40px; margin-bottom: 54px; padding: 0 10px 0; } .atuinCard-content p { font-size: 16px; margin: 0 0 20px; } .atuinCard-count:after { position: absolute; top: 48px; right: 0; font-size: 38px; line-height: 1; font-weight: bold; color: #ddd; counter-increment: count; content: "0"counter(count); transition: all 200ms linear; transition-delay: 0.1s; } .atuinCard:hover .atuinCard-count:after { color: #337AB7; } .atuinCard-icon { position: relative; height: 80px; width: 80px; background-color: #fff; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1); display: flex; align-items: center; justify-content: center; transition: all 200ms linear; transition-delay: 0.1s; border-radius: 15px; z-index: 2; transform: scale(0.8); } .atuinCard:hover .atuinCard-icon { background-color: #337AB7; } .atuinCard-icon svg { position: relative; display: inline-block; width: 50px; height: 50px; fill: #337AB7; transition-delay: 0.1s; transition: all 500ms ease; } .atuinCard:hover .atuinCard-icon svg { transform: rotateY(180deg); transition-delay: 0.1s; fill: #fff; } .atuinCard-title { font-size: 20px; line-height: 1.2; margin-top: 10px; margin-bottom: 14px; font-weight: bold; } .atuinCard-title a { color: #000; } .atuinCard-title a:hover { color: #337AB7; } .atuinCard-btn { position: absolute; bottom: 20px; left: 20px; display: inline-flex; align-items: center; justify-content: center; font-weight: bold; font-size: 15px; color: #000; border: 2px solid #ddd; padding: 8px 25px; border-radius: 30px; transition: color 0.5s ease-in-out, border 0.5s 0.2s ease-in-out; text-transform: uppercase; overflow: hidden; z-index: 2; text-align: center; } .atuinCard-btn:hover { color: #fff; border: 2px solid #337AB7; } .atuinCard-btn::before { content: ""; background-color: #337AB7; position: absolute; top: 0; width: 100%; left: 0; right: 0; bottom: 0; clip-path: circle(0% at 50% 50%); transition: all cubic-bezier(0, 0.96, 0.58, 1.1) 0.8s; z-index: -1; } .atuinCard-btn:hover::before { clip-path: circle(100% at 50% 50%); transition: all cubic-bezier(0, 0.96, 0.58, 1.1) 4s; transition-delay: 300ms; } .atuinCard-btn::after { content: ""; background-color: #BFE2FF; position: absolute; top: 0; width: 100%; left: 0; right: 0; bottom: 0; clip-path: circle(0% at 50% 50%); transition: all cubic-bezier(0, 0.96, 0.58, 1.1) 0.8s; z-index: -2; } .atuinCard-btn:hover:after { clip-path: circle(100% at 50% 50%); transition: all cubic-bezier(0, 0.96, 0.58, 1.1) 4s; } @media (min-width: 992px) { .atuinCard-count:after { top: 50px; font-size: 44px; } .atuinCard-icon { transform: scale(1); } .atuinCard-title { margin-top: 20px; } .atuinCard-title { font-size: 22px; } .atuinCard-content p { font-size: 18px; } } |

Добавить комментарий: