<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/css/all.min.css"
integrity="sha512-1PKOgIY59xJ8Co8+NE6FZ+LOAZKjy+KY8iq0G4B3CyeY6wYHN3yt9PW0XpSriVlkMXe40PTKnXrLnZ9+fkDaog=="
crossorigin="anonymous" />
<body>
<div class="center">
<div class="menu">
<li class="item" id="profile">
<a href="#profile" class="btn"><i class="far fa-user" aria-hidden="true"></i> Profile</a>
<div class="smenu">
<a href="">Posts</a>
<a href="">Picture</a>
</div>
</li>
<li class="item" id="message">
<a href="#message" class="btn"> <i class="far fa-envelope" aria-hidden="true"></i> Messages</a>
<div class="smenu">
<a href="">new</a>
<a href="">sent</a>
<a href="">spam</a>
</div>
</li>
<li class="item" id="Settings">
<a href="#Settings" class="btn"><i class="fas fa-cog" aria-hidden="true"></i> Settings</a>
<div class="smenu">
<a href="">Password</a>
<a href="">Language</a>
</div>
</li>
<li class="item" id="logout">
<a href="#" class="btn"><i class="fas fa-sign-out-alt"></i> Logout</a>
</li>
</div>
</div>
</body>
* {
margin: 0;
padding: 0;
font-family: sans-serif;
list-style: none;
text-decoration: none;
}
body {
background: rgb(55, 41, 16);
background: radial-gradient(circle, rgba(55, 41, 16, 1) 0%, rgba(0, 0, 0, 1) 100%);
width: 100vw;
height: 100vh;
}
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.menu {
width: 300px;
border-radius: 8px;
overflow: hidden;
}
.item {
border-top: 1px solid #000;
overflow: hidden;
background: #C28C2E;
color: #222220;
}
.btn {
display: block;
padding: 16px 20px;
background: #C28C2E;
color: #222220;
position: relative;
font-weight: bold;
}
.btn:before {
content: "";
position: absolute;
width: 14px;
height: 14px;
background: #C28C2E;
left: 20px;
bottom: -7px;
transform: rotate(45deg);
}
.btn i {
margin-right: 10px;
}
.smenu {
background: #222220;
overflow: hidden;
max-height: 0;
transition: max-height 0.3s ease;
}
.smenu a {
color: #C28C2E;
display: block;
padding: 16px 26px;
font-size: 14px;
margin: 4px 0;
position: relative;
}
.smenu a:before {
content: "";
width: 5px;
height: 100%;
position: absolute;
background: #C28C2E;
left: 0;
top: 0;
transition: 0.3s;
opacity: 0;
}
.smenu a:hover::before {
opacity: 1;
}
/*#profile:hover .smenu {
max-height: 100%;
}*/
.item:target .smenu {
max-height: 10em;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.