我正在尝试为网站创建导航栏。我想将 div 向上移动到#header. 我想用百分比来做到这一点(e.g bottom:50%)。但它只适用于像素(e.g bottom:200px)。
html,
body {
height: 100%;
}
#header {
position: relative;
height: 10%;
}
#logo {
background: red;
}
#logo img {
background-color: coral;
}
#logo h2 {
font-family: 'Gloria Hallelujah', cursive;
}
#nav nav {
position: relative;
left: 85%;
bottom: 50%;
margin: 1em;
}
#nav nav a {
font-family: 'Gloria Hallelujah', 'Rubik Mono One', sans-serif;
margin-right: 1em;
}
<div id="header">
<div id="logo">
<img src="" alt="" width="42" height="42">
<h2>title</h2>
</div>
<div id="nav">
<nav>
<a routerLink="/"> HOME </a>
<a routerLink="/about"> ABOUT </a>
<a routerLink="/blog"> BLOG </a>
</nav>
</div>
</div>