0

我有一个页面news.html,它是包含在我的index.html 中的php - 在#content div 中。news.html 有另一个 div,它浮动在右侧,并有一条垂直线 jpg 将其与主要内容分开,添加和类似的东西将放置在那里。

问题是我无法达到 100% 的高度(尽管它适用于 jpg 行),我认为原因是一些 css 问题。由于某种原因,我也不能将它放在页脚下方,因此 100% 高度线不会覆盖它。我为每个页面使用一个 main.css 文件。

如果我将 position:fixed 用于#poll div height 100% 有效,但是当放大/缩小浏览器时,我的 div 会移动,这不是我想要的。我知道有一个 min-width 属性,但似乎对我不起作用。

这是我的代码:

索引.html:

//Content div is placed inside a #main table//
<div id="content"><?php include "news.html"?></div>

主.css:

   html, body{
        height:100%;    
    }
        #main{  
            width:1010px;
            height:100%;
            z-index:2;
        }
        #content{
            margin-top: 303px;
            height:100%;
            z-index:1;
        }
        #footer{
            z-index:2;
        }
        #poll{
            height:100%
            background-color:rgba(255,0,0,0.6);
            float:right;
            z-index:1;
}

新闻.html

<div id="poll"><div style="background-image:url(images/vertical.jpg); width:5px; height:100%; background-repeat:repeat-y; vertical-align:top; position:fixed; top:0; z-index:0;"></div>
    <div>POLL CONTENT HERE</div>
</div>
4

2 回答 2

2

.....................

您好,如果您过去曾z-index担任过至少一个职位 relativeabsolute

比它的工作

像这样

{
z-index:2;
position:relative;
}

如何工作Z-index 链接在这里

于 2012-10-11T10:23:19.957 回答
2

z-index仅当您指定position元素的属性时才有效。因此,对于您给出的每个元素,z-index您需要将位置指定为

position: relative;

或者

position: absolute;
于 2012-10-11T10:25:22.670 回答