.hide-scroll{overflow: hidden;}.viewport{overflow: auto;/* Make sure the inner div is not larger than the container
* so that we have room to scroll.
*/max-height:100%;/* Pick an arbitrary margin/padding that should be bigger
* than the max width of all the scroll bars across
* the devices you are targeting.
* padding = -margin
*/margin-right:-100px;padding-right:100px;}
To disable vertical scroll bar just add : overflow-y:hidden;
Cross Browser Approach to hiding the scrollbar.
Css Code
/* make parent invisible */#parent{visibility: hidden;overflow: scroll;}/* safari and chrome specific style, don't need to make parent invisible because we can style webkit scrollbars */#parent:not(*:root){visibility: visible;}/* make safari and chrome scrollbar invisible */#parent::-webkit-scrollbar{visibility: hidden;}/* make the child visible */#child{visibility: visible;}
HTML :
Html Code
<h1>Wikitechy</h1><divid="box"><divid="content"><p>Hi !!! Welcome to Wikitechy</p></div>
CSS :
Css Code
h1{font-weight:bold;font-size:2em;}/* ignore only for header *//* *********************** */div#box{height:200px;width:300px;overflow:hidden;border:1px solid black;padding:10px;}div#content{height:200px;width:326px;/*
* Uncomment to see scrollbar
width:300px; */overflow:auto;}
Wikitechy Founder, Author, International Speaker, and Job Consultant. My role as the CEO of Wikitechy, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I'm a frequent speaker at tech conferences and events.