【发布时间】:2022-08-19 02:10:15
【问题描述】:
Example of what the navigation bar should look like
我正在用 html/css 制作我的第一个网站,我想制作一个可以适应移动屏幕的固定导航栏。它应该有一个左对齐的“home”按钮,其余按钮居中对齐。我怎样才能用 HTML/CSS 做这个?谢谢!
这是我目前的代码:
body {
background-color: white;
margin:0;
}
li a {
font-size: 14px;
line-height: 17px;
font-family: \'Inter\', sans-serif;
font-weight: 500;
}
ul {
list-style-type: none;
background-color: rgba(255, 255, 255, 0.4);
border: 1.5px solid rgba(0, 255, 255, 0.15);
backdrop-filter: blur(8px);
margin: 0;
padding: 0;
overflow: hidden;
text-align: center;
position: fixed;
top: 0;
width: 100%;
}
li {
display: inline-block;
}
li a {
text-decoration: none;
color: rgba(0, 0, 0, 0.60);
text-align: center;
padding: 12px 40px;
display: block;
transition:all 0.3s ease 0s;
text-align: center;
}
li a:hover {
color:black;
}
.left-links{
flex:1 1 200px;
text-align: left;
}
<html>
<head>
<meta charset=\"UTF-8\">
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">
<link rel = \"stylesheet\" href=\"navBar.css\">
<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">
<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>
<link href=\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">
</head>
<div>
<ul>
<div class=\"left-links\">
<li><a href=\"index.html\">Home</a></li>
</div>
<nav>
<li><a href=\"index.html\">Work</a></li>
<li><a href=\"me.html\">Me</a></li>
<li><a href=\"play.html\">Play</a></li>
</nav>
</ul>
</div>
<body>
<h1>Hello</h1>
</body>
</html>
-
请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。