如何使用CSS独立滚动列?

时间:2013-04-16 13:11:08

标签: css

这是我在这里的第一篇文章(我对这一切都很新),但我希望我能正确地提出这个问题。

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

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

非常感谢你的帮助!

这是my website

的CSS
    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;
    }

3 个答案:

答案 0 :(得分:0)

添加此CSS:#col1, #col2, #col3{ height: 500px; }您已使用overflow: scroll,因此会显示滚动条,

答案 1 :(得分:0)

http://jsfiddle.net/78PrJ/

这是一个工作示例。如上所述,您必须设置div height

答案 2 :(得分:-2)

只有在overflow:scroll中指定了高度时,

px才有效。如果您在%age中指定高度,则无效。

相关问题