html - Scrollbars not hiding -


i've stumbled upon rather interesting behavior related browser scrollbars. here link demonstrate this: http://jsfiddle.net/5l7tyswh/5/

html:

<div class='container'>   <div class='fix' /> </div> 

css:

body {     margin: 0; } .container {     position: absolute;     overflow: auto;     width: 100%;     height: 100%;     max-height: 400px;     max-width: 400px; }  .noscroll {     overflow: hidden; }  .fix {     width: 400px;     height: 400px;     background-color: green; } 

so situation this: want fixed sized div scrollable if window becomes smaller minimum. explicitly want scrollbars appear 'in div' created container acts 'scrollpanel'. far good.

the strangeness comes when shrink window small enough scrollbars show up, enlarge again. happens scrollbars don't hide should (at least think logical). don't know if bug or feature, tip on former. explanation vertical , horizontal scrollbars prevent each other disappearing.

the workaround commented javascript, if uncomment scrollbars behave meant to.

can explain better?

update:

i can reproduce in chrome far. works in ie11 , firefox.

looks bug or peculiarity of chrome ;) can prevent behavior in chrome without javascript , classes using @media directive in css

            @media screen , (min-width: 400px) {               .container {                 overflow: hidden;             }         } 

this prevents scrollbars appear when window bigger 400px. works on (recent) browsers.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -