Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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
位置:sticky不';html高度为100%时不工作_Html_Css_Height_Navbar_Sticky - Fatal编程技术网

位置:sticky不';html高度为100%时不工作

位置:sticky不';html高度为100%时不工作,html,css,height,navbar,sticky,Html,Css,Height,Navbar,Sticky,这是我对两个相关项目的CSS html, body { background-image: url("../images/background.png"); background-attachment: fixed; height: 100%; } --及-- 我的导航栏显示它应该显示的位置,但在网页上下移动时只是滚动。如果我删除html{height:100%;},那么粘性导航栏就会工作。我的目标是实现滚动-然后-粘贴效果 非常感谢您的建议 您的目标似乎是设置一个覆盖画布/屏幕的背景。如果

这是我对两个相关项目的CSS

html, body {
background-image: url("../images/background.png");
background-attachment: fixed;
height: 100%;

}
--及--

我的导航栏显示它应该显示的位置,但在网页上下移动时只是滚动。如果我删除html{height:100%;},那么粘性导航栏就会工作。我的目标是实现滚动-然后-粘贴效果


非常感谢您的建议

您的目标似乎是设置一个覆盖画布/屏幕的背景。如果是这种情况,您可能需要尝试更改css属性。那么,不要将高度设置为100%。请尝试以下方法:

background: url(../../img/back-lettre.jpg) fixed no-repeat;
background-size: cover;
-webkit-background-size: cover; /* Chrome & Safari */
-moz-background-size: cover; /* Firefox */
-o-background-size: cover; /* Opera */
如果这样做有效,它可能会帮助您避免设置阻止您的
位置:粘滞停止工作

background: url(../../img/back-lettre.jpg) fixed no-repeat;
background-size: cover;
-webkit-background-size: cover; /* Chrome & Safari */
-moz-background-size: cover; /* Firefox */
-o-background-size: cover; /* Opera */