In css, is there a rule(s) to make the x-scrollbar always hidden, but make the y-scrollbar show only if it goes past the page (i.e. only show if needed)?
Thanks
Use overflow: auto . Scrollbars will only appear when needed. (Sidenote, you can also specify for only the x, or y scrollbar: overflow-x: auto and overflow-y: auto ).
By default, a scroll bar will appear when the content is too long. Page authors can override this in a number of ways, for example: overflow-y: hidden => cut off content that is too long. overflow-y: scroll => always show a scroll bar even when it's not needed.
Add CSS. Set the overflow property to “auto”. This value adds scrollbar when the content overflows.
Try this:
body{overflow:hidden;overflow-y:auto;}
this will apply to all element . so no probability of horizontal scrollbar
*{
overflow-x:hidden;
}
for the y use the element u want
body{
overflow-y:auto;
}
you can use any other div if u want
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With