Home > database >  Hide the scroll bar but it still can scroll
Hide the scroll bar but it still can scroll

Time:03-09

This's my code:

<HStack width={"full"} overflowX={"auto"}>
   <Button>1</Button>
   <Button>2</Button>
   <Button>3</Button>
   <Button>4</Button>
   <Button>5</Button>
</HStack>

I've try overflow={"hidden"} for a Htack is the parent of this HStack but nothing happened

CodePudding user response:

Try like this

.scrolling-section {
  background-color: #eee;
  width: 200px;
  height: 100px;
  border: 1px dotted black;
  overflow: scroll; // Add the ability to scroll y axis
}

// Hide scrollbar for Chrome, Safari and Opera
.scrolling-section::-webkit-scrollbar {
    display: none;
}

// Hide scrollbar for IE, Edge and Firefox
.scrolling-section {
  -ms-overflow-style: none;  // IE and Edge
  scrollbar-width: none;  // Firefox
}

Then give this className to your division

  • Related