.cards_products .card { width: 250px; min-height: 350px; box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; /* Размещаем элементы в колонку */ border-radius: 7px; transition: 0.2s; position: relative; } .cards_products .card .card-id { width: 100%; height: 100%; position: absolute; z-index: 1; } /* При наведении на карточку - меняем цвет тени */ .cards_products .card:hover { box-shadow: 4px 8px 16px rgba(250, 230, 180, 0.2); } .cards_products .card .card__top { flex: 0 0 250px; /* Задаем высоту 250px, запрещаем расширение и сужение по высоте */ position: relative; overflow: hidden; /* Скрываем, что выходит за пределы */ } /* Контейнер для картинки */ .cards_products .card .card__top .card__image { display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .cards_products .card .card__top .card__image > img { width: 100%; height: 100%; border-radius: 7px; } /* Размещаем скидку на товар относительно изображения */ .cards_products .card .card__top .card__label { padding: 1px 4px; position: absolute; bottom: 5px; left: 5px; background: #ff9061; border-radius: 4px; font-weight: 400; font-size: 14px; color: #fff; } .cards_products .card .card__bottom { display: flex; flex-direction: column; flex: 1 0 auto; /* Занимаем всю оставшуюся высоту карточки */ padding: 10px; } .cards_products .card .card__bottom .card__prices { display: flex; justify-content: center; /* Центрируем все элементы */ align-items: center; /* Вертикальное выравнивание */ } .cards_products .card .card__bottom .card__prices .card__price { margin-right: 5px; /* Отступ между ценами */ } .cards_products .card .card__bottom .card__prices .favourites { margin-left: auto; /* Сдвигаем favourites вправо */ display: flex; /* Используем Flexbox */ align-items: center; /* Центрируем по вертикали */ justify-content: center; /* Центрируем по горизонтали */ } .cards_products .card .card__bottom .card__prices .favourites .icon-favourites { cursor: pointer; position: relative; /* Устанавливаем позицию для управления наложением */ z-index: 0; } .cards_products .card .card__bottom .card__prices .favourites-true .icon-favourites { fill: #00c906; } .cards_products .card .card__bottom .card__prices .favourites-false .icon-favourites { fill: #d1d1d1; } .cards_products .card .card__bottom .card__prices .favourites .id-favourites { width: 25px; /* Занимаем всю ширину родителя */ height: 25px; /* Занимаем всю высоту родителя */ margin: 0; /* Убираем отступы */ z-index: 5; position: absolute; /* Делаем элемент абсолютным для правильного наложения */ } @media (min-width: calc(250px * 3 + (20px * (3 - 1)) + 40px)) { .cards_products .card .card__bottom .card__prices .favourites:hover .icon-favourites { transform: scale(1.1); /* Увеличиваем размер при наведении */ } } .cards_products .card .card__bottom .card__prices .card__price::after { content: "₽"; margin-left: 4px; position: relative; } .cards_products .card .card__bottom .card__prices .card__price--discount { font-weight: 700; font-size: 19px; color: #267359; } .cards_products .card .card__bottom .card__prices .card__price--common { font-weight: 400; font-size: 15px; color: #c72d0a; text-decoration: line-through; /* Зачеркивание */ } .cards_products .card .card__bottom .card__title { text-decoration: none; display: block; margin-bottom: 1px; font-weight: 600; font-size: 17px; line-height: 150%; color: #1f3021; } .cards_products .card .card__bottom .card__short_description { text-decoration: none; display: block; font-weight: 400; font-size: 13px; line-height: 150%; color: #1f2b20; } .cards_products { display: grid; /* Автоматически заполняем на всю ширину grid-контейнера */ grid-template-columns: repeat(auto-fill, 250px); width: 100%; max-width: 1200px; /* Ширина grid-контейнера */ justify-content: center; justify-items: center; /* Размещаем карточку по центру */ column-gap: 20px; /* Отступ между колонками */ row-gap: 30px; /* Отступ между рядами */ margin: 0 auto; } /* Медиа-запрос для изменения стилей при узком экране */ @media (max-width: calc(250px * 3 + (20px * (3 - 1)) + 40px)) { /* Условие для одной карточки */ .cards_products .card { width:100%; min-height:250px; } .cards_products .card .card__top { flex:0 0 auto; padding-top: 100%; } .cards_products .card .card__bottom .card__title { font-size:13px; } .cards_products .card .card__bottom .card__short_description { font-size:10px; } .cards_products .card_condition_false .card__bottom .card__condition { font-size: 10px !important; } .cards_products .card_condition_true .card__bottom .card__condition { font-size: 10px !important; } .cards_products { grid-template-columns: repeat(auto-fill, minmax(220px,1fr)) !important; column-gap:5px; row-gap:10px; } } @media (max-width: calc(220px * 3 + (20px * (3 - 1)) + 40px)) { /* Условие для одной карточки */ .cards_products { grid-template-columns: repeat(auto-fill, minmax(200px,1fr)) !important; column-gap:5px; row-gap:10px; } } @media (max-width: calc(200px * 3 + (10px * (3 - 1)) + 40px)) { /* Условие для одной карточки */ .cards_products { grid-template-columns: repeat(auto-fill, minmax(180px,1fr)) !important; column-gap:5px; row-gap:10px; } } @media (max-width: calc(180px * 3 + (10px * (3 - 1)) + 40px)) { /* Условие для одной карточки */ .cards_products { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)) !important; column-gap:5px; row-gap:10px; } } @media (max-width: calc(150px * 3 + (5px * (3 - 1)) + 31px)) { /* Условие для одной карточки */ .cards_products { grid-template-columns: repeat(auto-fill, minmax(150px,1fr)) !important; column-gap:5px; row-gap:10px; } } .cards_products .card_condition_true .card__bottom .card__condition { font-weight: 400; font-size: 13px; color: #287330; text-decoration: none; } .cards_products .card_condition_true .card__bottom .card__condition::before { content: "✔ В наличии"; } .cards_products .card_condition_false .card__bottom .card__condition { font-weight: 400; font-size: 13px; color: #8a2d2d; text-decoration: none; } .cards_products .card_condition_false .card__bottom .card__condition::before { content: "❌ Нет в наличии"; }