+ 12

How to lock scrolling in HTML?

I have this code: https://code.sololearn.com/Wd04Wx4OaDL3 I want that the button do go outside the screen, but then scrolling should be locked. I mean, user can't see that the button is there, and I can translate it back to the screen whenever I need it. How can I do this? [ Note ] I just want to lock horizontal scroll, vertical should work fine.

27th Mar 2019, 8:48 AM
Letsintegreat
Letsintegreat - avatar
4 Answers
+ 13
Tried adding max-width and overflow-x properties for the html and body? html, body{ max-width:100%; overflow-x:hidden; } It should be helpful for you.
27th Mar 2019, 9:05 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 10
Shashi Ranjan Woo, thanks, it worked😊
27th Mar 2019, 9:07 AM
Letsintegreat
Letsintegreat - avatar
+ 10
overflow-x property work for horizontal scroll and overflow-y for vertical. And default value is auto.
29th Mar 2019, 9:06 PM
Ahad
Ahad - avatar
+ 4
Try using the overflow-x property
27th Mar 2019, 10:30 PM
Alpha
Alpha - avatar