<ul class="menu">
<li>
<a href="#0" data-icon="">
About
</a>
</li>
<li>
<a href="#0" data-icon="">
Projects
</a>
</li>
<li>
<a href="#0" data-icon="">
Clients
</a>
</li>
<li>
<a href="#0" data-icon="">
Contact
</a>
</li>
</ul>
<hr>
<ul class="menu" data-animation="to-left">
<li>
<a href="#0" data-icon="">
About
</a>
</li>
<li>
<a href="#0" data-icon="">
Projects
</a>
</li>
<li>
<a href="#0" data-icon="">
Clients
</a>
</li>
<li>
<a href="#0" data-icon="">
Contact
</a>
</li>
</ul>
<footer class="page-footer">
<small>Made with <span>❤</span> by <a href="http://georgemartsoukos.com/" target="_blank">George Martsoukos</a>
</small>
</footer>
:root {
--body-bg-color: #1a1c1d;
--text-color: #aaaebc;
--hr-color: #26292a;
--timing-function: cubic-bezier(0.82, 0.2, 0.42, 1);
--red: #e74c3c;
}
ul {
list-style: none;
}
a {
color: inherit;
text-decoration: none;
}
body {
margin: 30px 0;
font: 22px sans-serif;
background: var(--body-bg-color);
color: var(--text-color);
}
hr {
border-color: var(--hr-color);
margin: 20px 0;
}
.menu {
display: flex;
justify-content: center;
}
.menu li {
margin-right: 70px;
}
.menu a {
position: relative;
display: block;
padding: 10px;
overflow: hidden;
transition: color 0s 0.25s var(--timing-function);
}
.menu a::before,
.menu a::after {
position: absolute;
left: 0;
width: 100%;
}
.menu a::before {
content: '';
top: 50%;
transform: translate(-101%, -50%);
height: 50%;
z-index: 1;
background: var(--text-color);
transition: transform 0.5s var(--timing-function);
}
.menu a::after {
content: attr(data-icon);
font-family: "Font Awesome 5 Free";
font-weight: 900;
top: 0;
display: flex;
align-items: center;
justify-content: center;
height: 100%;
color: var(--text-color);
opacity: 0;
transition: opacity 0s 0.25s var(--timing-function);
}
.menu a:hover {
color: transparent;
}
.menu a:hover::before {
transform: translate(101%, -50%);
}
.menu a:hover::after {
opacity: 1;
}
/* ANIMATIONS
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.menu[data-animation="to-left"] a::before {
transform: translate(101%, -50%);
}
.menu[data-animation="to-left"] a:hover::before {
transform: translate(-101%, -50%);
}
/* FOOTER
–––––––––––––––––––––––––––––––––––––––––––––––––– */
.page-footer {
position: absolute;
bottom: 10px;
right: 10px;
font-size: 1rem;
}
.page-footer span {
color: var(--red);
}
This Pen doesn't use any external JavaScript resources.