我正在关注 YouTube 教程,并且编写了完全相同的代码,但我无法让我的徽标像他们的那样与导航对齐
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.navbar {
display: flex;
align-items: center;
padding: 20px;
}
nav {
flex: 1;
text-align: right;
}
nav ul {
display: inline-block;
list-style-type: none;
}
nav ul li {
display: inline-block;
margin-right: 20px;
}
a {
text-decoration: none;
color: #555;
}
p {
color: #555;
}
STUDENT HUB
我尝试在导航栏选择器下使用 Vertical-align: center 和 Display: inline-block 但它也不起作用
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
您必须将
nav标记放入navbardiv 中。* { margin: 0; padding: 0; box-sizing: border-box; } .navbar { display: flex; align-items: center; padding: 20px; } nav { flex: 1; text-align: right; } nav ul { display: inline-block; list-style-type: none; } nav ul li { display: inline-block; margin-right: 20px; } a { text-decoration: none; color: #555; } p { color: #555; }