<分区>
这是我的代码,希望你们能帮助我。
我试图创建一个导航栏,该导航栏固定在页面顶部并在用户向下滚动时移动。
<!DOCTYPE html>
<html>
<title>New Technology Planet</title>
<head>
<style>
header {
background-image : url("pic15.jpg");
color:white;
text-align:center;
padding:150px;
}
ul{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
border-right:1px solid #bbb;
}
li.logo{
border-right: none;
font-family:Impact, Charcoal, sans-serif;
color:white;
font-size:40px;
margin-top: 15px;
padding-left:30px;
}
li:last-child {
border-right: none;
}
li a {
display: block;
color: white;
text-align: center;
padding: 25px 30px;
text-decoration: none;
font-size:20px;
}
li a:hover:not(.active) {
background-color: #111;
}
.active {
background-color: #4CAF50;
}
#section {
width:350px;
float:center;
padding:10px;
}
#footer {
background-image : url("pic17.jpg");
color:white;
clear:both;
text-align:center;
padding:100px;
}
#header{
font-family: "Comic Sans MS", cursive, sans-serif;
}
</style>
</head>
<body>
<header>
<h1>New Technology Planet</h1>
<p><h3>The WebSite Is Still Under Construction By Laith SJ</h3></p>
<p>Teamspeak3 & WebSites Hosting</p>
<p>Our goal is to give you the best what we can do!</p>
</header>
<!-- Navagator start -->
<nav role='navigation'>
<ul>
<li class="logo">NewTecPlanet</li>
<ul style="float:right;list-style-type:none;">
<li><a class="active" href="#home">Home</a></li>
<li><a href="#news">News|Updates</a></li>
<li><a href="#contact">Products</a></li>
<li><a href="#login">SignUp | Login</a></li>
<li><a href="#about">About US</a></li>
<li><a href="#about">Contact Us</a></li>
</ul>
</ul>
</nav>
<!-- navagattor end code -->
<!-- -->
<div id="section">
<h2>test</h2>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
<p>Test</p>
</div>
<!-- last part of the page -->
<div id="footer">
New Technology Planet
</div>
</body>
</html>
如果您认为有什么好东西可以帮助观众,请随时编辑帖子,并希望您可以编辑代码以使其正常工作。
如果您需要有关我要问的内容的示例,请告诉我,我不想发布其他网站,所以我不会违反任何规则。
谢谢