Unable to move my GitHub icon/link to the bottom of the navbar. I'm trying to use the last-child margin-top auto however it won't work for me. is there something wrong in my code, or am I going about it the wrong way? any advice would be great. I'm new to HTML and CSS so if you see anything you would change in general please let me know.
:root {
font-size: 16px;
font-family: 'Open sans';
}
* {
margin: 0;
padding: 0;
font-family: sans-serif;
}
body {
color: white;
background-color: black;
}
body::-webkit-scrollbar {
width: 0.3rem;
}
body::-webkit-scrollbar-track {
background-color: red;
}
body::-webkit-scrollbar-thumb {
background-color: blueviolet;
}
main {
margin-left: 15rem;
padding: 1rem;
}
/****** Navbar ******/
.img-logo {
width: 15rem;
margin-top: 1rem;
}
.navbar {
position: fixed;
background-color: blueviolet;
width: 15rem;
height: 100vh;
}
.navbar-nav {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
}
.nav-link {
display: flex;
align-items: center;
height: 5rem;
}
.nav-item:last-child {
margin-top: auto;
}
<body>
<div class="navbar">
<nav>
<img class="img-logo" src="img/Logo.png" alt="My logo">
<ul class="navbar-nav">
<li class="nav-item">
<a href="#" class="nav-link">
<i class="fa-solid fa-house"></i>
<span class="link-text">Home</span>
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="fa-solid fa-user"></i>
<span class="link-text">About Me</span>
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="fa-solid fa-screwdriver-wrench"></i>
<span class="link-text">What I Do</span>
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="fa-solid fa-folder-open"></i>
<span class="link-text">Projects</span>
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="fa-solid fa-id-card"></i>
<span class="link-text">Contact</span>
</a>
</li>
<li class="nav-item">
<a href="#" class="nav-link">
<i class="fa-brands fa-github"></i>
<span class="link-text"></span>
</a>
</li>
</ul>
</nav>
</div>