<link href="https://fonts.googleapis.com/css2?family=Playfair+Display&display=swap" rel="stylesheet">
<div class="container">
  <ul class="menu1">
    <li>Home</li>
    <li>About</li>
    <li>Blog</li>
    <li>Projects</li>
    <li>Contact</li>
  </ul>
  <ul class="menu2">
    <li><span>Home</span></li>
    <li><span>About</span></li>
    <li><span>Blog</span></li>
    <li><span>Projects</span></li>
    <li><span>Contact</span></li>
  </ul>
  <ul class="menu3">
    <li><span>Home</span></li>
    <li><span>About</span></li>
    <li><span>Blog</span></li>
    <li><span>Projects</span></li>
    <li><span>Contact</span></li>
  </ul>
  <ul class="menu4">
    <li><span>Home</span></li>
    <li><span>About</span></li>
    <li><span>Blog</span></li>
    <li><span>Projects</span></li>
    <li><span>Contact</span></li>
  </ul>
</div>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.container {
  font-family: "Playfair Display", serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  background: #4776e6;
  background: -webkit-linear-gradient(to right, #8e54e9, #4776e6);
  background: linear-gradient(to right, #8e54e9, #4776e6);
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.menu1,
.menu2,
.menu3,
.menu4 {
  height: 100px;
  width: 100%;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  list-style: none;
  padding: 0 100px;
}

.menu1 li,
.menu2 li,
.menu3 li,
.menu4 li {
  height: 60px;
  font-size: 25px;
  position: relative;
  text-transform: uppercase;
  margin: 20px;
  padding: 10px 40px;
  box-shadow: rgba(50, 50, 93, 0.25) 0px 50px 100px -20px,
    rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
}

/* ---------------------- Style 1 -------------------------- */

.menu1 li {
  padding: 10px 40px;
  border-radius: 50px;
  background-color: #fff;
  z-index: 10;
  color: #0f2027;
}

.menu1 li::before,
.menu1 li:after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0%;
  left: 0%;
  background-color: #fff;
  opacity: 1;
  transition: all 0.5s cubic-bezier(0.075, 0.81, 0.165, 1);
  border-radius: 50px;
  z-index: -1;
}

.menu1 li:after {
  transition: all 0.5s 250ms cubic-bezier(0.075, 0.81, 0.165, 1);
}

/* On hover the sudo before and after elements are scaled 1.5 times with opacity changed from 1 to 0 */
.menu1 li:hover:before,
.menu1 li:hover:after {
  opacity: 0;
  transform: scale(1.5);
}

/* ---------------- Style 2 ------------------------------------ */

.menu2 li {
  padding: 10px 80px;
  border-radius: 50px;
  background-color: tomato;
  color: #0f2027;
  overflow: hidden;
  display: flex;
  justify-content: center;
  margin-right: 30px;
}
.menu2 li span {
  z-index: 100;
  color: #fff;
}

.menu2 li::before,
.menu2 li::after {
  content: "";
  position: absolute;
  display: block;
  width: 110%;
  height: 110%;
  left: -5%;
  right: 0%;
  opacity: 0;
  border-radius: 50px;
}

.menu2 li:before {
  background-color: rgba(71, 118, 230, 0.5);
  transition: all 0.3s cubic-bezier(0.075, 0.81, 0.165, 1);
  top: 0;
  transform: translateY(-100%);
}

.menu2 li:after {
  background-color: rgba(71, 118, 230, 1);
  transition: all 0.3s 250ms cubic-bezier(0.075, 0.81, 0.165, 1);
  bottom: 0;
  transform: translateY(100%);
}

/* On hover the 'before' and 'after' elements are traslated back to 0 from -100% and 100%, the trasition of 'after' element as a added delay */
.menu2 li:hover:before,
.menu2 li:hover:after {
  transform: translateY(0px);
  opacity: 1;
}

/* ---------------- Style 3 ------------------------------------ */

.menu3 li {
  padding: 10px 40px;
  color: #0f2027;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu3 li span {
  z-index: 100;
  color: #111;
}

.menu3 li::before,
.menu3 li::after {
  content: "";
  position: absolute;
  display: block;
}

.menu3 li:before {
  height: 100%;
  width: 0;
  right: 0;
  border-top: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transition: all 500ms cubic-bezier(0.075, 0.81, 0.165, 1);
}

.menu3 li:after {
  background-color: transparent;
  height: calc(100% - 4px);
  width: 0;
  left: 0;
  transition: all 1s cubic-bezier(0.075, 0.81, 0.165, 1);
}

/* On hover the 'before' and 'after' element's width is increased from zero to 100%, this caused the 'before' elements's top and bottom borders to increase the width from 0 to 100%, in 'after' element the increase  cause the background fill effect*/
.menu3 li:hover:before {
  width: 100%;
}

.menu3 li:hover:after {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.7);
}

/* ---------------- Style 4 ------------------------------------ */

.menu4 li {
  padding: 10px 40px;
  border-radius: 0px;
  color: #0f2027;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu4 li span {
  z-index: 100;
  color: #111;
  transition: all 500ms cubic-bezier(0.075, 0.81, 0.165, 1);
}

.menu4 li::before {
  content: "";
  position: absolute;
  display: block;
  width: calc(100% - 4px);
  height: 0;
  right: 0;
  bottom: 0;
  border-left: 2px solid #fff;
  border-right: 2px solid #fff;
  transition: all 500ms cubic-bezier(0.075, 0.81, 0.165, 1);
}

/* On hover the 'before' elements height get increased from 0 to 100% ans the span element's letter spacting increase from 1 to 4px */
.menu4 li:hover:before {
  background-color: transparent;
  height: 100%;
  transition: all 1s cubic-bezier(0.075, 0.81, 0.165, 1);
}

.menu4 li:hover span {
  letter-spacing: 4px;
  color: #fff;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.