我只学习了几周的代码,所以我有非常基础的知识。 我在尝试使用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>
答案 0 :(得分:1)
让我们清楚地说明,当您使用伸缩框时,它适用于子级,而不适用于子级;当您将default
应用于导航栏时,它将使 ul 变为伸缩子级,因此 li标签不能弯曲,其次,您要使其成为纵列,以便使其以垂直方式显示。
解决方案:您可以制作ul
/* Stop at This Frame
The Animate timeline will stop/pause at the frame where you insert this code.
Can also be used to stop/pause the timeline of movieclips.
*/
stop();
var offset:int = 10
PP1.buttonMode = true;
PP1.addEventListener(MouseEvent.MOUSE_DOWN, startdragging);
PP1.addEventListener(MouseEvent.MOUSE_UP, stopdragging);
var PP1StartX:int = 30
var PP1StartY:int = 343
var PP1EndX:int = 617
var PP1EndY:int = 97
//------------------------------
function startdragging(e:MouseEvent):void {
e.currentTarget.startDrag();
}
function stopdragging(e:MouseEvent):void{
e.currentTarget.stopDrag();
switch(e.currentTarget){
}
}
默认情况下,它将使li转到行方向