CSS hide scroll bar, but have element scrollable

前端 未结 8 1676
南旧
南旧 2021-01-30 03:46

I have this element called items and the content inside the element is longer than the element height, I want to make it scrollable but hide the scroll bar, how would I do that?

8条回答
  •  梦谈多话
    2021-01-30 04:41

    if you really want to get rid of the scrollbar, split the information up into two separate pages.

    Usability guidelines on scrollbars by Jakob Nielsen:

    There are five essential usability guidelines for scrolling and scrollbars:

    • Offer a scrollbar if an area has scrolling content. Don't rely on auto-scrolling or on dragging, which people might not notice.
    • Hide scrollbars if all content is visible. If people see a scrollbar, they assume there's additional content and will be frustrated if they can't scroll.
    • Comply with GUI standards and use scrollbars that look like scrollbars.
    • Avoid horizontal scrolling on Web pages and minimize it elsewhere.
    • Display all important information above the fold. Users often decide whether to stay or leave based on what they can see without scrolling. Plus they only allocate 20% of their attention below the fold.

    To make your scrollbar only visible when it is needed (i.e. when there is content to scroll down to), use overflow: auto.

提交回复
热议问题