.carousel { width: 100%; display: flex; justify-content: center; border-radius: 10px; padding: 6px 25px; } .glav-text { width: 100%; padding: 6px 25px; } .my-carousel { background-color: #40916c; margin: 0; width: 100%; height: 60vh; display: flex; justify-content: center; align-items: center; border-radius: 10px; } @media (max-width: 600px) { .my-carousel { height: 50vh; } .carousel, .glav-text { padding: 3px 5px; } } @media (min-width: 1000px) { .my-carousel { height: 70vh; } .carousel, .glav-text { padding: 10px 50px; } } .my-carousel img { object-fit: cover; width: 100%; height: 100%; border-radius: 10px; } /* - - - - - - - - - - - - - - - - - - - */ .cards_products_types .card-mi { width: 250px; 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_types .card-mi .card-types { width: 100%; height: 100%; position: absolute; z-index: 2; } /* При наведении на карточку - меняем цвет тени */ .cards_products_types .card-mi:hover { box-shadow: 4px 8px 16px rgba(250, 230, 180, 0.2); } .cards_products_types .card-mi .card__top { flex: 0 0 250px; /* Задаем высоту 250px, запрещаем расширение и сужение по высоте */ position: relative; overflow: hidden; /* Скрываем, что выходит за пределы */ border-radius: 7px; } /* Контейнер для картинки */ .cards_products_types .card-mi .card__top .card__image { display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .cards_products_types .card-mi .card__top .card__image > img { width: 100%; height: 100%; border-radius: 7px; } .cards_products_types .card-mi .card__top .card__label_top { position: absolute; top: 30px; /* Изменено с bottom на top */ left: 10px; font-weight: 600; font-size: 25px; display: inline; line-height: 1.25; padding: .333rem 0 .222rem; background-color: #fff; text-transform: uppercase; box-decoration-break: clone; -webkit-box-decoration-break: clone; box-shadow: .556rem 0 0 #fff, -0.556rem 0 0 #fff; } .cards_products_types .card-mi .card__top .card__label_top div { z-index: 1; display: inline; position: relative; text-decoration: none; color: #3c3c3c; background-color: #fff; } .cards_products_types .card-mi .card__bottom { display: flex; flex-direction: column; flex: 1 0 auto; /* Занимаем всю оставшуюся высоту карточки */ padding: 10px; } .cards_products_types { 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_types .card-mi { width:100%; } .cards_products_types .card-mi .card__top { flex:0 0 auto; padding-top: 100%; } .cards_products_types { 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_types { 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_types { grid-template-columns: repeat(auto-fill, minmax(170px,1fr)) !important; column-gap:5px; row-gap:10px; } .cards_products_types .card-mi .card__top .card__label_bottom, .cards_products_types .card-mi .card__top .card__label_top { font-size: 20px; } } @media (max-width: 355px) { /* Условие для одной карточки */ .cards_products_types .card-mi .card__top { padding-top: 200px; } /* Контейнер для картинки */ .cards_products_types .card-mi .card__top .card__image { position: absolute; top: 0; left: 0; width: auto; height: auto; /* Укажите фиксированную высоту */ overflow: hidden; /* Обрезка содержимого, которое выходит за пределы */ object-fit: cover; /* Обрезает изображение по размеру контейнера, сохраняя пропорции */ } .cards_products_types .card-mi .card__top .card__image > img { width: 100%; } }