How to remove only the horizontal scrollbar from the page?

Asked

Viewed 127 times

1

I am creating an application in Electron and need to remove from the page a scrollbar horizontal. I tried using the CSS code below, but it also removes the scrollbar vertical.

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

2 answers

4


This does not remove the scroll, it hides, if to remove the right would apply directly on the elements:

html, body {
    overflow-x: hidden;
}

We apply to both because in Chrome and Firefox it is usually (or was) different to the standard scrollbar element

I must point out, if you have a horizontal scrollbar that should not exist is because you have an element that is exceeding the width of the page, then use things like overflow it’s just gambiarra, you have to IDENTIFY the element that is exceeding the limits of view-port using your browser’s Devtools

  • Press F12 (usually) and open Devtools
  • Scroll as far as you can to the right
  • Select the tool to select elements: inspecionar elementos
  • By hovering the mouse on the right side of the page, you will surely find the element

0

You could try it that way, Jeanextreme002.

::-Webkit-scrollbar { overflow-y:Hidden; }

  • The white space where the scrollbar still permance. What I want is the scrollbar completely removed.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.