css - Absolute positioning of elements produces an unwanted horizontal scrollbar on <html>, though no element exceeds the viewport -


i'm building web application occupies browser's visible area without scrollbars. window divided panes have own scrollbars when necessary.

i've laid out elements neatly absolute positioning. demo: http://jsbin.com/adozul/6/edit

extract:

<body>     <header id="header"></header>     <div id="main">       <section class="pane"></section>       <section class="pane"></section>       <section class="pane"></section>       <section class="pane"></section>     </div> </body> 
#header, #main, .pane {     bottom: 0;     left: 0;     position: absolute;     right: 0;     top: 0; } #header {     bottom: none;     height: 35px; } #main {     top: 36px; } .pane:nth-child(1) {     left: 0;     right: 75%; } .pane:nth-child(2) {     left: 25%;     right: 50%; } .pane:nth-child(3) {     left: 50%;     right: 25%; } .pane:nth-child(4) {     left: 75%;     right: 0; } 

everything looks fine except wild horizontal scrollbar appears (both in firefox , chrome).

the weird thing according firebug, blank space @ right side not belong element on page, , no element has margins either.

upd: passerby pointed out, there element exceeds width, it's inside fourth pane, solution pretty obvious.

i've tracked issue down rule:

.pane:nth-child(4) {     left: 75%; } 

when disable rule, horizontal scrollbar disappears. disabling other panes' positioning rules doesn't affect scrollbar.

i can rid of scrollbar html { overflow: hidden; }. but why scrollbar appear in first place , how prevent appearing (rather dealing when it's there) without breaking four-pane layout?

ps if feel task solved in more elegant way, please don't hesitate point out. please take consideratoin i'm going let user resize panes jquery ui resizable.

it looks it's <iframe> inside 4th panel exceeds width;

add this

.pane:nth-child(4) iframe {   width:100%; } 

seems solve problem on 1024 width screen.

http://jsbin.com/onotur/1/edit

edit:

seems better:

.pane .editor {     width:100%; } 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -