Не вылезают карточки товаров за пределы области

Столкнулся с такой проблемой, что у меня не вылезают карточки товаров за пределы области slider_box. Я знаю, что за скрытие элементов, выходящих за область, отвечает overflow: hidden, но если я его вставлю в slider_box, элементы (карточки товаров) подстраиваются под область, соответственно, размеры сужаются, и карточки выглядят некрасиво, хотя карточки должны просто выйти за пределы, а то что за пределами - скрыться. Я пробовал и в main_banner overflow:hidden поставить - тоже самое. В чем может быть проблема?

html код:


<div class = "store_page row">
    <div class="slider_box">
            <div class = main_banner>
                {% for product in products %}
                <article class="product_card">
                    <div class="product_image">
                        <div class="product_switch image-switch">
                            <div class="image-switch_item">
                                <div class="image-switch_img"><img src="{{product.imageURL}}"></div>
                            </div>
                        </div>
                        <ul class="product_image-pagination image-pagination">
                            <li class="image-pagination_item">
                                
                            </li>
                            
                        </ul>
                    </div>
                    <h3 class="product_title">
                        <a class="product_name" href="#">{{product.name}}</a>
                    </h3>
                    <div class="product_info">
                        <span class="article">
                            Артикул: число
                        </span>
                        <span class="available">
                            В наличии: много
                        </span>
                    </div>
                    <div class="product_price">
                        <span class="current_price">{{product.price|floatformat:2}} ₽</span>
                    </div>
                    <button class="add_product_btn">
                        Добавить в корзину
                    </button>
                    
                </article>
                {% endfor %}



            </div>

        </div>


</div>

css код:


.store_page{
    width: 100%;
    height: auto;
    background-color: white;
    margin: auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    border-radius: 10px;
}

.slider_box{
    position: relative;
    width: auto;
    max-height: 400px;
    display: flex;
}

.slider_box .main_banner{
    margin: 20px;
    display: flex;
    min-width: 370px;
    height: 370px;
    line-height: auto;
    overflow: hidden;
    overflow-x: auto;
}

.main_banner .product_card{
    margin: 5px;
    width: 285px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    padding: 20px;
    padding-top: 9px;

}

.slider_box .main_banner: :-webkit-scrollbar {
    display: none;
}
.product_image{
    overflow: hidden;
    position: relative;
    display: block;
    height: 100px;
}


.image-switch{
    position: absolute;
    left: 0;
    top: 0;
    z-index: 20;
    width: 100%;
    height: 100%;
    display: flex;
}

.image-switch_item{
    flex-grow: 1;
    cursor: pointer;

}

.image-switch_img{
    position: absolute;
    left: 50%;
    top: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    transform: translateX(-50%);
    pointer-events: none;
    background-color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.image-switch_img img{
    display: block;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-switch_img:first-child .image-switch_img {
    opacity: 1;
    z-index: -1;
}

.image-switch_img:hover .image-switch_img {
    opacity: 1;
    z-index: -1;
}

.product_title{
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 20px;
    font-weight: 400;
}

.product_name{
    color: var(--color-dark);
}

.product_info{
    font-size: 12px;
    color: var(--color-light);
}

.article{
    display: block;
    margin-bottom: 8px  ;
}

.product_price{
    display: block;
}

.product_price{
    display: flex;
    align-items: center;

}

.current_price{
    font-size: 24px;
    line-height: 28px;

    color: var(--color-dark);
}

До overflow: hidden До overflow: hidden После overflow: hidden После overflow: hidden


Ответы (1 шт):

Автор решения: Kirya Mac

Проблема решена. Что я изменил:


.store_page{
    width: 1105px;
}

.slider_box{
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans' sans-serif;
    font-weight: 400;
}

.slider_box .main_banner{
    width: 1060px;
    overflow: hidden;
    overflow-x: auto;
}

.main_banner .product_card{
    flex-shrink: 0;
}

Изменив эти строки, проблема решилась :)

→ Ссылка