Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS固定标题_Html_Css_Twitter Bootstrap - Fatal编程技术网

Html CSS固定标题

Html CSS固定标题,html,css,twitter-bootstrap,Html,Css,Twitter Bootstrap,我正试图将我的头球固定在顶部。我看过其他帖子,确信我做得对。这是标题的CSS: .header{ width: 100%; position:fixed; top: 0px; } 由于某种原因,当我这样做时,标题消失了。你知道为什么吗?我应该如何更改代码? 仅供参考,我正在使用引导并将其添加到其中 非常感谢,Stefan 看到这么多答案后,我做了这么多编辑,但它又消失在我身上。我使用的CSS是: position: fixed; width:960px; 还要帮忙吗

我正试图将我的头球固定在顶部。我看过其他帖子,确信我做得对。这是标题的CSS:

.header{
    width: 100%;
    position:fixed;
    top: 0px;
}
由于某种原因,当我这样做时,标题消失了。你知道为什么吗?我应该如何更改代码? 仅供参考,我正在使用引导并将其添加到其中

非常感谢,Stefan

看到这么多答案后,我做了这么多编辑,但它又消失在我身上。我使用的CSS是:

position: fixed; 
width:960px;

还要帮忙吗?非常感谢。

在您的
位置上输入一个简单的错误
-您希望
修复
而不是
修复

.header{
     width: 100%;
     position:fixed;
     top: 0px;
}

看起来你的代码不错。您可以尝试使用firebug插件检查元素,并查看其中的任何冲突。您也可以尝试添加高度,如果仍然无法解决,则可以查看一篇解释制作过程的文章

.header{
 width: 100%;
 position:fixed;
 top: 0px;
 height:50px;
}

编辑
修复
修复
。它可能需要
z-index
谢谢你,我没有意识到这一点。:)@StefanwalzerGoldfeld有点专业提示:习惯在浏览器中使用开发工具(Chrome、Firefox、Internet Explorer)。您将能够导航到标题元素,并且在CSS检查面板中,
position:fixes
将被突出显示/注释为“不正确的值”。浏览器中的开发者工具?另外,还没有在网上发布,所以我可以这样做。