Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove scrollbar like overflow hidden but needs to be visible

When you smallen your browser to 1000px width then there is a horizontal scrollbar, is there any way to remove this above 1000px? Check my screendump below.

I have tried a clearfix but this didn't help and tried overflow:visible;

.clearfix:before,
.clearfix:after {
  content: ".";    
  display: block;    
  height: 0;    
  overflow: hidden; 
}
.clearfix:after {clear: both;}
.clearfix {zoom: 1;} /* IE < 8 */

Any clean easy way to fix this with css?

like image 490
user123 Avatar asked Aug 22 '13 09:08

user123


People also ask

How do you make the scrollbar only visible when overflow?

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 ).

How do I get rid of overflow scroll?

To hide the scrollbar and disable scrolling, we can use the CSS overflow property. This property determines what to do with content that extends beyond the boundaries of its container. To prevent scrolling with this property, just apply the rule overflow: hidden to the body (for the entire page) or a container element.

Why scroll bar is appearing when not needed?

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.


2 Answers

@media all and (min-width: 1000px) {
body {
  margin:0;
}
.wrapper {
  overflow-x: hidden;
  }
}

If browser is more then 1000px wide there won't be horizontal scroll.

like image 61
Vladislav Stanic Avatar answered Oct 05 '22 12:10

Vladislav Stanic


The only thing that you can do (which still keeps your site accesible), is set the width on which the scrollbar should appear.

You can fix that by setting a minimum width for the body.

Add this to your stylesheet:

body { min-width: 1200px; }

When the browser is resized smaller than 1200px, the scrollbar will appear.

like image 27
LinkinTED Avatar answered Oct 05 '22 12:10

LinkinTED