css - 如何使用 CSS 使列独立滚动?

标签 css

这是我在这里的第一篇文章(我对这一切都很陌生),但我希望我问的是正确的。

我正在为我的硕士论文创建一个网页,我需要有三个平行的文本列,它们将相互独立滚动,很像 this template

我似乎无法从该模板中获取 CSS 在我的网站上运行,我想知道我做错了什么,或者是否有更好的方法来实现此效果。

非常感谢您的帮助!

这是我的 CSS my website

    body {
    padding:0;          
    width:100%;
    height: 100%;
    max-height: 100%;
    overflow; hidden;
    margin: 0;
    border: 0;
    background:#FFFFFF;     
    }

#title { 

    margin-bottom: 5px;
    background: #fff;
    width:100%
    z-index: 20;
    width: 100%;
    padding-top: 30px;
    }

#title h1 {

    font-family: Sorts Mill Goudy, Garamound, serif;
    font-size: 50px;
    text-align: center;
    font-weight: 100;
    color: 696969;
    line-height: 1px;
    letter-spacing: 10px;
    margin-top: 20px;   
    }



#title h2 {
    font-size: 16px;
    font-family: Sorts Mill Goudy, serif;
    text-align: center;
    font-weight: 100;
    color: #999;
    line-height: 20px;
    letter-spacing: 0px;
    }


#title ul {text-align:center; 
    padding-left, padding-right: 10px;
    padding-top: 30px;
    }

#title ul li {
    display:inline;
    font-family: "gill sans mt", "sans-serif";
    text-align: center;
    list-style:none;
    margin-left:0px;
    padding-left: 30px;
    padding-right: 30px;
    }

#title p{
    font-family: Sorts Mill Goudy Italic, Garamound, serif;
    size: 14px;
    font-weight: 300;
    background: #eee;
    padding: 10px;
    margin-left: 80px;
    margin-right: 80px;
    margin-top: 20px;
    margin-bottom: 15px;
    text-decoration: none;
    color: #000;
    }


#title a {
    color:#000;
    text-decoration: none;
    text-decoration: underline;
    }

#title a:hover {
    color: #A9A9A9;
    text-decoration: underline;
    }

/*  column settings */

#allcol {
    position: relative;
    }

#allcol h4{
    text-align: center;
    }

#col1 {
        font-family: Sorts Mill Goudy, Garamound, serif;
        text-align: left;
        float:left;
        background:#DCDCDC;
        padding-bottom:10px;
        padding-top: 10px;
        padding-left:1.5%;
        padding-right:1.5%;
        margin-left: 0px;
        width:30%;
        overflow: scroll;
        }

#col2 {     font-family: Sorts Mill Goudy, Garamound, serif;
        text-align: left;
        background: #fff;
        float:left;
        padding-bottom:10px;
        padding-top: 10px;
        padding-left:1.5%;
        padding-right:1.5%;
        width:30%;
        overflow: scroll;
        }

#col3 { font-family: Sorts Mill Goudy, Garamound, serif;
        text-align: left;
        float:left;
        background:#DCDCDC;
        padding-left:1.5%;
        padding-right:1.5%;
        padding-bottom:10px;
        padding-top: 10px;
        width:30%;
        overflow: scroll;
        }

#footer {
    clear:both;
    float:left;
    width:100%;
    border-top:1px solid #000;
    }

最佳答案

http://jsfiddle.net/78PrJ/

这是一个工作示例。如前所述,您必须设置 div 高度

关于css - 如何使用 CSS 使列独立滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16037993/

相关文章:

javascript - 单击 overflow-y 内的 anchor 链接时如何防止页面向下滚动?

html - 如何删除水平滚动条填充 (Firefox)?

jquery - 接受 =“image/*” 和 jQuery 验证

html - CSS:样式在 `<pre>` 元素后重置

css - 怎么自定义material UI选择组件?

css - 嵌套 Bootstrap 行

javascript - 保持 div 相对于图像定位

java - 在页面等待服务器时加载 CSS 和 JS

JavaFX 着色 XYChart.Series

javascript - 如何自动水平滚动到div内的中间?