css让一个区域可滑动的代码

不需要scroll view~

.item-container {
    margin-top: 176rpx;
    width: 628rpx;
    height: 700rpx;
    max-height: 700rpx;
    display: grid;
    grid-template-columns: repeat(3, 194rpx);
    grid-auto-rows: 262rpx;
    gap: 30rpx;
    justify-content: start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.item-container::-webkit-scrollbar {
    width: 6px;
}

.item-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.item-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.item-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

Comments

No comments yet. Why don’t you start the discussion?

发表回复