我试图创建一个导航栏,当我向下滚动但当我放置 position:fixed; 时它是粘性的;在文本上,这样它们就会向下滚动,它们也会重叠。我不想使用 jquery,因为我的教授。这么说。
<html>
<head> <title> My Portfolio </title>
<link rel="stylesheet" type = "text/css"
href="stylesheet.css"> </head>
<body>
<ul>
<a href="Index.html"> Home </a>
<a href="About.html" > ABOUT </a >
<a href="Projects.html" >PROJECTS </a >
<a href="Resume.html" >RESUME </a >
<a href="Gallery.html" > GALLERY </a >
<b> </b>
</body>
</html>
CSS
body{
background-position:fixed;
background-repeat:repeat-x;
background-color:white;
font-family:Arial;
font-size:20px;
}
a{
color:#1b1b1b;
TEXT-DECORATION: NONE;
position:fixed;
z-index:2;
}
b{
top:0;
height:30px;
width: 100%;
background:white;
text-align:left;
position:fixed;
z-index:1;
}
最佳答案
您正在寻找这样的人吗?
关于html - 滚动顶部导航栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21956540/