CSS样式不会使用样式呈现屏幕外元素

时间:2013-02-22 16:50:18

标签: html5 css3

我在正确退出屏幕元素方面遇到了问题。我认为这个问题与溢出属性有关。如果我以全屏(1080p)查看浏览器就可以了,但是当我将浏览器的大小调整为较小的分辨率,然后向下滚动时,屏幕元素的样式就会消失。

编辑[删除链接以防止将来出现断链]

    /* DEFAULT */

* {
    margin: 0px;
    font-family: Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 12px;    
}
@font-face {
    font-family: leela;
    src: url('leelawad_0.ttf');
}
html, body {
    height: 100%;
    background-color: rgb(255,255,255);
}
h1 {
    color: rgb(183,183,183);
    font-family: leela;
    font-size: 16px;
    font-weight: normal;
    text-transform: uppercase;
}
a {
    color: rgb(102,102,102);    
    text-decoration: none;  
}

/* ID */

#container {
    height: 100%;
    overflow-x: hidden;
    width: 100%;
}
#header {
    border: 1px solid rgb(153,153,153);
    border-top: 0px;
    background-color: rgb(255,255,255);
    padding: 8px;
    position: fixed;
    width: 100%;
    z-index: 3;
}
#quickSearch {
    border: 1px solid rgb(153,153,153);
    background-color: rgb(250,250,250);
    height: 30px;
    margin: 8px 8px 8px 8px;
}
    #quickSearch input {
        background-color: rgb(250,250,250);
        border: 0px;
        height: 28px;
        margin-left: 10px;
        margin-top: 0px;
        float: left;
    }
#naviContainer {
    float: left;
    width: 200px;
    border-right: 1px solid rgb(153,153,153);
    background-color: rgb(225,225,225);
    height: 100%;
}
#navigation {
    background-color: rgb(225,225,225);
    float: left;
    width: 200px;
    margin-top: 31px;
    position: relative;
    z-index: 2;
    height: 100%;
}
    #navigation ul {
        margin: 0px;
        padding: 0px;
        width: 200px;

    }
    #navigation li {
        display: block;
        list-style-type: none;
        -webkit-transition: all 0.25s ease-in-out;
        -moz-transition: all 0.25s ease-in-out;
        -o-transition: all 0.25s ease-in-out;
        transition: all 0.25s ease-in-out;
    }
    #navigation li:hover {
        background-color: rgb(173,173,173);
        -webkit-transition: all 0.25s ease-in-out;
        -moz-transition: all 0.25s ease-in-out;
        -o-transition: all 0.25s ease-in-out;
        transition: all 0.25s ease-in-out;
    }
    #navigation h1 {
        border-bottom: 1px dotted rgb(153,153,153);
        background-color: rgb(127,127,127);
        padding: 8px;
    }
    #navigation h1.fix {
        border-top: 1px dotted rgb(153,153,153);
    }
    #navigation ul li {
        border-bottom : 1px dotted rgb(153,153,153);
    }
    #navigation li a {
        display: block;
        padding: 8px;
    }
#contentContainer {
    margin-left: 201px;
    margin-top: 31px;
    position: relative;
}
#breadcrumbs {
    background-color: rgb(239,239,239);
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: rgb(153,153,153);
    padding: 8px;
    position: inherit;
}
    #breadcrumbs ul {
        display: inline;
        margin-left: 0px;
        padding: 0px;
    }
    #breadcrumbs li {
        display: inline;
    }
#content {
    padding: 8px;
    position: inherit;
}
/* CLASSES */

.divider {
    border-left: solid 1px rgb(102,102,102);
    margin: 0px 7px 0px 5px;;
}

非常感谢任何输入!

2 个答案:

答案 0 :(得分:1)

尝试使用position添加:fixed(我将其设为黄色,以便突出显示):

#navigation {
    background-color: yellow;
    border-right: 1px solid #999999;
    border-top: 0 none;
    float: left;
    height: 100%;
    margin-top: 31px;
    position: fixed;
    width: 200px;
    z-index: 2;
}

[编辑]第二次尝试,移除高度。

#navigation {
    background-color: #E1E1E1;
    float: left;
    //height: 100%;
    margin-top: 31px;
    position: relative;
    width: 200px;
    z-index: 2;
}

答案 1 :(得分:0)

这不过是身高:100%问题

删除高度:#naviContainer的100%将修复此问题。

#navigation {
  background-color: #E1E1E1;
  float: left;
  min-height: 100%;
  margin-top: 31px;
  position: relative;
  width: 200px;
  z-index: 2;
}

#naviContainer {
  background-color: #E1E1E1;
  border-right: 1px solid #999999;
  float: left;
  min-height: 100%;  /* the fix */
  width: 200px;
}