1 / 4
[img]https://i.ibb.co/MP25TzB/Chris-and-Anna-1-copy.webp[/img]
Chris and Anna
Forever starts here 💍
[img]https://i.ibb.co/JR0SjM1/Chris-and-Anna-2-copy.webp[/img]
Chris and Anna
Two hearts, one promise ❤️
[img]https://i.ibb.co/CtG7B4z/Chris-and-Anna-3-copy.webp[/img]
Chris and Anna
Brothers, united for the big day 🤵♂️
[img]https://i.ibb.co/vqcxBG0/Chris-and-Anna-4-copy.webp[/img]
Chris and Anna
Her squad, his crew, together for the love of two 👰♀️🤵♂️
❮
❯
здесь можно увидеть проблему
codepen
--если вы используете мобильное устройство, возможно, оно отображается неправильно. Я еще не оптимизировал для мобильных устройств.--
Я попробовал обернуть изображение и счетчик карусели в новом относительно позиционированном элементе, попробовал переместить .carousel-counter в CSS. возможно, я неправильно обернул, но не могу найти ошибку.
.image-item img { max-width: 100%; /* Prevents the image from exceeding its container's width */ height: auto; aspect-ratio: 3 / 2; /* Maintain aspect ratio */ object-fit: cover; border-radius: 10px; max-height: 400px; /* Adjust this value to control the height of the images */ box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.5); margin-bottom: 15px; }
/* Carousel Styles */ .carousel { position: relative; /* Make this container the reference for absolutely positioned elements */ width: 100%; margin: 0 auto; }
.carousel-container { position: relative; /* Ensure the container is the reference for absolute positioning */ overflow: hidden; /* Prevent overflow of slides or elements */ }
.carousel-slide { position: relative; /* Ensure the slide is the reference for absolute positioning */ display: flex; justify-content: center; align-items: center; flex-basis: 100%; /* Ensures each slide takes up the full width of the carousel */ }
.carousel-slide p { flex-basis: auto; /* Let the text adapt to its content size */ }
/* Horizontal images (3:2 aspect ratio) */ .carousel-slide img.horizontal { aspect-ratio: 3 / 2; /* Force 3:2 aspect ratio */ object-fit: cover; /* Crop to fit */ width: 100%; /* Ensure the image fills the container width */ height: auto; /* Maintain aspect ratio */ border-radius: 10px; box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.5); }
/* Vertical images (2:3 aspect ratio) */ .carousel-slide img.vertical { aspect-ratio: 2 / 3; /* Force 2:3 aspect ratio */ object-fit: contain; /* Maintain aspect ratio without cropping */ width: 100%; /* Ensure the image fills the container width */ height: auto; /* Maintain aspect ratio */ border-radius: 10px; box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.5); }
.carousel-slide img { max-width: 100%; height: auto; object-fit: contain; /*to maintain aspect ratio */ border-radius: 10px; max-height: 400px; margin-bottom: 15px; box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.5); flex-basis: auto; /* Allow images to take up only as much space as needed */ }
/* Counter */ .carousel-counter { position: absolute; top: 10px; /* Move the counter to the top */ left: 10px; /* Move the counter to the left */ background: rgba(0, 0, 0, 0.5); color: white; padding: 5px 10px; border-radius: 5px; font-size: 14px; z-index: 10; pointer-events: none; /* Prevent interaction */ }
[img]https://i.ibb.co/MP25TzB/Chris-and-Anna-1-copy.webp[/img] Chris and Anna Forever starts here 💍
[img]https://i.ibb.co/JR0SjM1/Chris-and-Anna-2-copy.webp[/img] Chris and Anna Two hearts, one promise ❤️
[img]https://i.ibb.co/CtG7B4z/Chris-and-Anna-3-copy.webp[/img] Chris and Anna Brothers, united for the big day 🤵♂️
[img]https://i.ibb.co/vqcxBG0/Chris-and-Anna-4-copy.webp[/img] Chris and Anna Her squad, his crew, together for the love of two 👰♀️🤵♂️
❮ ❯
[/code]
здесь можно увидеть проблему codepen --если вы используете мобильное устройство, возможно, оно отображается неправильно. Я еще не оптимизировал для мобильных устройств.-- Я попробовал обернуть изображение и счетчик карусели в новом относительно позиционированном элементе, попробовал переместить .carousel-counter в CSS. возможно, я неправильно обернул, но не могу найти ошибку.