disable horizontal scroll on mobile web
Simply add this CSS:
html, body {
overflow-x: hidden;
}
body {
position: relative
}
I've found this answer over here on stackoverflow which works perfectly for me:
use this in style
body {
overflow-x: hidden;
width: 100%;
}
Use this in head tag
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
A slight addition of mine in case your body has padding (to prevent the device from scaling to the body content-box, and thus still adding a horizontal scrollbar):
body {
overflow-x: hidden;
width: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
For me, the viewport meta tag actually caused a horizontal scroll issue on the Blackberry.
I removed content="initial-scale=1.0; maximum-scale=1.0;
from the viewport tag and it fixed the issue. Below is my current viewport tag:
<meta name="viewport" content="user-scalable=0;"/>
Try this code,overflow will help to remove scrollbar.You can use it also for any div which is scrolling.
html, body {
overflow-x: hidden;
}
body {
width:100%;
}
This works for me across all mobile devices in both portrait and landscape modes.
<meta name="viewport" content="width=device-width, initial-scale = 0.86, maximum-scale=3.0, minimum-scale=0.86">