Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/39.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中给出预期结果_Html_Css - Fatal编程技术网

导航“;“位置固定”;未在html中给出预期结果

导航“;“位置固定”;未在html中给出预期结果,html,css,Html,Css,我使用position:fixed为我的导航栏编写了一个停留在固定位置的代码这样,当任何人试图滚动页面时,页面会保持在当前位置,但我没有得到想要的结果 这是我的导航栏(不更改代码):- 但当我添加位置时:固定在我的编码中,如:- #navul01 { list-style-type: none; margin: 0; padding: 0; overflow: hidden; background-color: transparent; po

我使用
position:fixed为我的导航栏编写了一个停留在固定位置的代码
这样,当任何人试图滚动页面时,页面会保持在当前位置,但我没有得到想要的结果

这是我的导航栏(不更改代码):-


但当我添加
位置时:固定在我的编码中,如:-

#navul01 {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: transparent;
    position: absolute;
    right: 0;
    bottom: 0;
    position: fixed;
}
我的导航栏移动到页面底部:-


但是如果我移除
底部:0来自我的代码:-

#navul01 {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: transparent;
    position: absolute;
    right: 0;
}

在这两种情况下,我的导航栏都会移动到此位置:-


而且我不能删除
位置:绝对来自我的代码,因为它还更改了我的导航栏的位置:-

#navul01 {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: transparent;
    right: 0;
}


我想要什么?:-


这是我的密码:-

#navul01 {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: transparent;
    position: absolute;
    right: 0;
}
标题{
宽度:100%;
高度:350px;
位置:相对位置;
溢出:隐藏;
z指数:-1;
边框:3倍纯色灰色;
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg.com/640/480/any");
背景尺寸:封面;
}
.主包装{
位置:相对位置;
} 
#navul01{
列表样式类型:无;
保证金:0;
填充:0;
溢出:隐藏;
背景色:透明;
位置:绝对位置;
右:0;
底部:0;
}
#纳武利{
浮动:左;
}
#navul01 li a{
显示:块;
颜色:白色;
字体大小:粗体;
文本阴影:2px 2px黑色;
文本对齐:居中;
填充:14px 16px;
字体大小:25px;
文字装饰:无;
边框:2倍纯白;
}
#navul01 li a:悬停{
背景颜色:浅绿色;
}
#科目导航{
列表样式类型:无;
保证金:0;
填充:0;
位置:绝对位置;
左:10%;
宽度:80%;
}
#科目(导航李a){
显示:块;
颜色:白色;
字体大小:5vw;
字体大小:粗体;
文本阴影:2px 2px黑色;
文本对齐:居中;
填充:50px 50px;
文字装饰:无;
边框:3倍纯白;
过渡:1s;
}
#主题(u nav li a):悬停{
利润率:0-5%;
}
#物理图像{
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg.com/640/480/any");
背景尺寸:封面;
}
#化学图像{
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg.com/640/480/any");
背景尺寸:封面;
}
#数学图像{
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg.com/640/480/any");
背景尺寸:封面;
}
#空间{
列表样式:无;
}

使用固定的z索引,并使用顶部而非底部计算位置。该值应为标题高度减去导航栏高度:

全速运行代码段,因为它无法处理缩小的大小,因为标题太大

标题{
宽度:100%;
高度:350px;
位置:相对位置;
溢出:隐藏;
z指数:-1;
边框:3倍纯色灰色;
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg.com/640/480/any");
背景尺寸:封面;
}
.主包装{
位置:相对位置;
} 
#navul01{
列表样式类型:无;
保证金:0;
填充:0;
溢出:隐藏;
背景色:透明;
位置:固定;
右:0;
顶部:300px;
z指数:999;
}
#纳武利{
浮动:左;
}
#navul01 li a{
显示:块;
颜色:白色;
字体大小:粗体;
文本阴影:2px 2px黑色;
文本对齐:居中;
填充:14px 16px;
字体大小:25px;
文字装饰:无;
边框:2倍纯白;
}
#navul01 li a:悬停{
背景颜色:浅绿色;
}
#科目导航{
列表样式类型:无;
保证金:0;
填充:0;
位置:绝对位置;
左:10%;
宽度:80%;
}
#科目(导航李a){
显示:块;
颜色:白色;
字体大小:5vw;
字体大小:粗体;
文本阴影:2px 2px黑色;
文本对齐:居中;
填充:50px 50px;
文字装饰:无;
边框:3倍纯白;
过渡:1s;
}
#主题(u nav li a):悬停{
利润率:0-5%;
}
#物理图像{
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg.com/640/480/any");
背景尺寸:封面;
}
#化学图像{
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg.com/640/480/any");
背景尺寸:封面;
}
#数学图像{
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg.com/640/480/any");
背景尺寸:封面;
}
#空间{
列表样式:无;
}

使用固定的z索引,并使用顶部而非底部计算位置。该值应为标题高度减去导航栏高度:

全速运行代码段,因为它无法处理缩小的大小,因为标题太大

标题{
宽度:100%;
高度:350px;
位置:相对位置;
溢出:隐藏;
z指数:-1;
边框:3倍纯色灰色;
背景位置:中心;
显示器:flex;
背景图像:url(“https://placeimg
#navul01 {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: transparent;
    right: 0;
}