【发布时间】:2021-09-13 20:21:33
【问题描述】:
我想让应用程序的徽标(当前为“AppName”)与左侧的汉堡菜单内联。所以没有顶部奇怪的空白区域。有什么想法吗?
我的代码:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AppName</title>
<link rel="stylesheet" href="/app.css">
<link rel="stylesheet" href="/fontawesome-free-5.15.3-web/css/all.css">
</head>
<body>
<div class="nav">
<span onclick="openMenu()"><i class="fas fa-bars"></i></span>
<h1 class="logo">AppName</h1>
</div>
</body>
</html>
CSS:
@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,400;0,700;1,400;1,700&display=swap');
*{
font-family: 'Rubik', sans-serif;
margin: 0;
}
.nav{
background-color: #0A0E44;
padding: 20px;
color: white;
}
.fas{
font-size: 40px;
padding-left: 20px;
}
.logo{
*display: flex;(Tried this does not work)
align-items: center; (Tried this does not work)
justify-content: center;* (Tried this does not work)
}
.navbar{
*display: inline;* (Tried this does not work)
}
请帮帮我!
BeldrNl
【问题讨论】:
标签: html css position alignment vertical-alignment