.carousel-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: auto;
}

.carousel-items {
    display: flex;
    flex-wrap: nowrap;
    width: 150%; /* 将子容器宽度扩大5倍 */
}

.carousel-items img {
    width: 20%;
    margin-right: 1rem;
    flex: 1;
}

.carousel-prev,
.carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background-color: rgba(0,0,0,0.5);
    color: #fff;
    text-align: center;
    line-height: 50px;
    cursor: pointer;
}

.carousel-prev {
    left: 0;
}

.carousel-next {
    right: 0;
}


/* 根据不同屏幕尺寸改变样式 */
@media (max-width: 768px) {
    .carousel-items img {
        width: 50%;
    }
    .carousel-container {
        height: 250px;
    }
}

@media (max-width: 480px) {
    .carousel-items img {
        width: 100%;
        margin-right: 0;
    }
    .carousel-container {
        height: 180px;
    }
}
@keyframes carousel-animation {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-100%);
    }
}

.carousel-items {
    /* 动画设置 */
    animation: carousel-animation 20s infinite linear;
}

.carousel-items:hover {
    /* 鼠标悬停时终止动画 */
    animation-play-state: paused;
}