How can I make this 100% height + column overflow layout work in Firefox and IE?
I have a three-column layout that takes up 100% width and height of the browser (with padding). This layout contains two columns which also take up 100% height and should scroll independently.
Here is a jsfiddle: http://jsfiddle.net/KdZ9A/2/. Here is how it looks in Chrome (desirable -- individual columns scroll):

and Firefox and IE (undesirable -- body is scrolling):

This works perfectly in Chrome; however, the in Firefox and IE (10), the entire page scrolls instead of individual columns scrolling. I only want the columns to overflow and scroll -- not the body. Any idea how to make this work in Firefox and IE?
I've also tried a bit different approach using absolute positioning of the columns' contents: http://jsfiddle.net/KdZ9A/3/.
Here is the HTML I am using:
<div id="container">
    <div id="inner">
        <div id="palette">palette</div>
        <div id="list">
            <div class="content"></div>
        </div>
        <div id="editor">
            <div class="content"></div>
        </div>
    </div>
</div>
I'm using absolute positioning to achieve 100% height and then display of table and table-cell inside that to achieve 100% height of the columnns:
* {
    padding: 0;
    margin: 0;
}
html, body {
    width: 100%;
    height: 100%;
}
body {
    position: relative;
}
#container {
    background-color: #f1f1f1;
    position: absolute;
    left: 20px;
    right: 20px;
    top: 20px;
    bottom: 20px;
}
#inner {
    display: table;
    height: 100%;
}
#inner > div {
    display: table-cell;
}
#palette {
    min-width: 180px;
    max-width: 180px;
    width: 180px !important;
    background-color: pink;
}
#list {
    width: 55%;
    min-width: 350px;
    background-color: cyan;
}
#editor {
    width: 45%;
    min-width: 400px;
    background-color: magenta;
}
.content {
    overflow: auto;
    height: 100%;
}
I was 5 minutes from giving up and HOLY CRAP...I GOT IT WORKING
http://jsfiddle.net/gFX5E/15/
This is based on the different approach I mentioned. I needed to wrap .content divs and make the wrappers position relative. I also added some headers to the columns.
HTML:
<div class="content-wrap">
    <div class="content">
        ...
    </div>
</div>
CSS:
.content-wrap {
    position: relative;
    height: 100%;
}
.content {
    overflow: auto;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
}
Seems to work in Chrome, Safari, Firefox, and IE8+.
And here is a more semantic HTML5 version which also adds a header to the top: http://jsfiddle.net/gFX5E/20/. I believe this will require use of html5shiv to work in IE8.
If you are willing to settle for a fixed total width, here is how:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Demo</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<style>
    * {
      padding: 0;
      margin: 0;
      box-sizing: border-box; /* makes filling up easier */
    }
    html, body {
      height: 100%;
    }
    #container {
      position: relative;
      width: 980px;
      height: 100%;
      margin: auto;
      background: grey;
    }
    #palette {
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      right: 800px;
      background: pink;
    }
    #list {
      position: absolute;
      left: 180px;
      top: 0;
      bottom: 0;
      right: 450px;
      background: cyan;
      overflow-y: auto;
    }
    #editor {
      position: absolute;
      left: 530px;
      top: 0;
      bottom: 0;
      right: 0;
      background: magenta;
      overflow-y: auto;
    }
</style>
</head>
<body>
  <div id="container">
    <div id="palette">Palette</div>
    <div id="list" class="content"></div>
    <div id="editor" class="content"></div>
  </div>
<script>
    $(function() {
        for (var i=0; i<20; i++) {
            $('.content').append('<p>Lorem ipsum [truncated for SO]</p>');
        }
    });
</script>
</body>
</html>
Demo on this Codepen: http://codepen.io/anon/pen/aqgCm?editors=100.
 This is a pretty old post, but I thought I'd comment.  If you display: flex instead of display: table in your 1st example that should fix the issue.  
Also setting your scroll container height to 100vh will also do the trick.
链接地址: http://www.djcxy.com/p/79468.html