#css# Altura excedida, desplazable hacia arriba y hacia abajo

<div class="test">
    <div class="item" v-for="list in 10" >
        <p class="title">这是一条数据</p>
    </div>
</div>

Agregue el siguiente código dentro del div más grande

.test {
       width: 200px;
        max-height: 300px; //设置最大的高度
        overflow:auto; // 超出这个最大高度的数据,会被隐藏起来,上下滑动
        overflow-x:hidden; //隐藏x轴滚动条
        .item {
            width: 90%;
            margin: auto;
            text-align: center;
            .title {
                width: 100%;
                font-size: 15px;
                font-weight: normal;
                background-color: #999999;
            }
        }
    }

Si desea ocultar la barra de desplazamiento, puede utilizar el siguiente código

 .test::-webkit-scrollbar {
        display: none;
    }

 

Supongo que te gusta

Origin blog.csdn.net/ZHENGCHUNJUN/article/details/128465398
Recomendado
Clasificación