body { font-family: Arial, sans-serif; margin: 0; padding: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background-color: #f4f4f4; } .carousel { position: relative; width: 150%; max-width: 1000px; overflow: hidden; border-radius: 5px; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); } .carousel-inner { display: flex; transition: transform 2s ease-in-out; } .carousel-item { min-width: 100%; transition: opacity 1.9s ease-in-out; } .carousel-item img { width: 100%; height: 100%; object-fit: contain; /* Ensures the entire image fits within the carousel item */ display: block; background-color: rgb(255, 255, 255); /* Optional: add a background color if there's empty space */ } .carousel-control { position: absolute; top: 50%; transform: translateY(-50%); background-color: rgba(0, 0, 0, 0.5); color: white; border: none; padding: 10px; cursor: pointer; font-size: 18px; } .carousel-control.prev { left: 20px; } .carousel-control.next { right: 20px; }