Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.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中使用position:Fixed也无法工作_Html_Css_Navigation_Overriding_Border - Fatal编程技术网

Html 固定导航栏即使在css中使用position:Fixed也无法工作

Html 固定导航栏即使在css中使用position:Fixed也无法工作,html,css,navigation,overriding,border,Html,Css,Navigation,Overriding,Border,在页面顶部放置固定导航时遇到问题。我已经尝试过位置:固定为顶部:0,宽度:100%,但导航栏底部放置引导的图像重叠。这是我的HTML和CSS的全部代码。几个小时以来,我一直试图通过资源找到这个问题,但我仍然不知道问题出在哪里 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport&q

在页面顶部放置固定导航时遇到问题。我已经尝试过位置:固定为顶部:0,宽度:100%,但导航栏底部放置引导的图像重叠。这是我的HTML和CSS的全部代码。几个小时以来,我一直试图通过资源找到这个问题,但我仍然不知道问题出在哪里

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<link rel="stylesheet" href="testing.css">
<!--SOCIAL MEDIA ICON STYLESHEET-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>J[a]Son | Art & Code </title>
<div class="top">
  <div class = "center">
    <h><a href="J.html">J[a]son</a></h>
    <p>Personal Blog</p>
  </div>
    <div class = "top">
      <div class = "logos">
        <a href="https://www.facebook.com/jason.ahn.129/" class="fa fa-facebook"></a>
        <a href="https://www.linkedin.com/in/jasonja-ahn/" class="fa fa-twitter"></a>
      </div>
      <div class = "nav">
        <ul>
          <li><a href="J.html">HOME</a></li>
          <li><a href="#photography">PHOTOGRAPHY</a></li>
          <li><a href="#coding">CODING</a></li>
          <li><a href="#about">ABOUT</a></li>
        </ul>
      </div>
    </div>
</div>

尝试向导航栏添加
z-index:100
,使其位于所有其他元素的前面。
另外,如果您将
z-index
添加到其他元素中,则该数字应低于100或您为
z-index

指定的数字。非常感谢!
body {
background-color: rgb(241, 233, 233);
}

html, body {
height: 90%;
margin: 0;
padding: 0;
}

.top {
margin: auto;
padding: 0.5em;
overflow: hidden;
background-color: #0a0908; 
width: 100%;
top: 0;
position: fixed;
display: block;
/*position: -webkit-sticky;
position: sticky;*/
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}

.top p {
color: white;
font-size: 10px;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif
 }

.center {
text-align: center;
 }

.center a{
color: rgb(224, 224, 228);
font-size: 1.5em;
}

.center a:hover{
text-decoration: none;
color: rgb(224, 224, 228);
}

.nav a {
color: white;
}

.nav ul {
list-style-type: none;
display: inline-block;
}

.nav li {
display: inline;
}

.nav {
float: right;
}

.logos {
float: left;
}

.logos a {
color: white;
}

.top {
clear: both;
overflow: hidden;
}

.nav li a {
color: white;
text-align: center;
padding: 20px 15px;
text-decoration: none;
font-size: 13px;
position: relative;
}

.nav li a:hover::after, a:focus::after {
opacity: 1;
transform: translateY(-2px);
}

.nav li a::after {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 1px;
background: white;
content: '';
opacity: 0;
transition: opacity 0.2s, transform 0.2s;
transform: translateY(4px);
}

.testing {
padding: 0;
display: block;
margin: auto;
max-height: auto;
max-width: 50%;
}

img {
display: block;
margin-left: auto;
margin-right: auto;
width: auto;
height: 600px;
}

.carousel-inner p {
text-align: center;
}

.carousel-control-prev-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg 
xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 8 8'%3E%3Cpath d='M5.25 0l-4 4 
4 4 1.5-1.5-2.5-2.5 2.5-2.5-1.5-1.5z'/%3E%3C/svg%3E");
}

.carousel-control-next-icon {
background-image: url("data:image/svg+xml;charset=utf8,%3Csvg 
xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 0 8 8'%3E%3Cpath d='M2.75 0l-1.5 
1.5 2.5 2.5-2.5 2.5 1.5 1.5 4-4-4-4z'/%3E%3C/svg%3E");
}