【发布时间】:2020-10-23 01:30:26
【问题描述】:
我只学了几个星期的代码,所以我掌握了非常基础的知识。 我在尝试使用 flexbox 构建导航栏时遇到了困难。
由于某种原因,我无法获得导航按钮(
这是我的代码的链接:https://codepen.io/kokazp/pen/xxORovj?editors=1100
提前致谢。
body{
font-family: 'Yanone Kaffeesatz', sans-serif;
background-color: lightGray;
}
navbar {
background: white;
box-shadow: 0px 0px 10px var(--clr-gray200);
padding: 1rem 0;
border-radius: var(--radius);
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
}
#header-img{
height: 70px;
width: 70px;
margin-right: auto;
margin-left: 10px;
}
ul{
list-style: none;
margin: 0;
padding: 0;
}
li, a{
background-color:white;
text-decoration: none;
padding: 8px;
color:black;
}
li a:hover{
background-color: black;
color: white;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link href="https://fonts.googleapis.com/css2?family=Yanone+Kaffeesatz:wght@300&display=swap" rel="stylesheet">
<link rel=StyleSheet HREF="estilo.css">
</head>
<body>
<header id="header">
<navbar id="nav-bar">
<ul>
<li><img src="https://blog.spoongraphics.co.uk/wp-content/uploads/2017/craft-brewery-logos/1.jpg" id="header-img" alt="Company logo"></li>
<li><a href="#form">Contact</a></li>
<li><a href="#beers">Beers</a></li>
<li><a href="#video">Video</a></li>
</ul>
</navbar>
</header>
</body>
</html>
【问题讨论】:
标签: html css frontend navbar nav