Full code snippets:
`<!DOCTYPE html>
Illusionistic Neon Navbar
<br>
* {<br>
margin: 0;<br>
padding: 0;<br>
box-sizing: border-box;<br>
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;<br>
}</p>
<div class="highlight"><pre class="highlight plaintext"><code> body {
min-height: 100vh;
background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.navbar {
position: relative;
width: 600px;
height: 80px;
background: rgba(255, 255, 255, 0.1);
border-radius: 20px;
display: flex;
justify-content: space-evenly;
align-items: center;
backdrop-filter: blur(15px);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
overflow: visible;
}
.navbar ul {
display: flex;
width: 100%;
padding: 0 20px;
position: relative;
z-index: 5;
}
.navbar ul li {
position: relative;
list-style: none;
width: 70px;
height: 70px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
margin-left:30px;
transition: transform 0.5s ease-in-out;
}
.navbar ul li a {
position: relative;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 100%;
text-align: center;
font-weight: 500;
color: white;
text-decoration: none;
}
.navbar ul li a .icon {
position: relative;
font-size: 24px;
transition: 0.5s;
}
.navbar ul li:hover a .icon {
transform: translateY(-5px);
color: #00ffff;
text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
}
.navbar ul l.active a .text {
position: absolute;
opacity: 0;
font-size: 12px;
transition: 0.5s;
transform: translateY(15px);
}
.navbar ul li:hover a .text,
.navbar ul li.active a .text {
opacity: 1;
}
/* Glowing Indicator */
.indicator {
position: absolute;
width: 80px;
height: 80px;
background: red;
border-radius: 50%;
transition: 0.5s ease-in-out;
z-index: 1;
top: -50px; /* Positioned above navbar */
left: 50%;
transform: translateX(-50%) scale(0);
}
/* Active Effect */
.navbar ul li.active .icon {
color: white;
transform: translateY(-30px) scale(1.2);
text-shadow: 0 0 10px rgb(210, 202, 202), 0 0 20px rgba(255, 255, 255, 0.8);
}
.navbar ul li.active {
transform: translateY(-15px);
z-index: 10;
}
.navbar ul li.active a {
position: relative;
z-index: 15;
}
</style>
</code></pre></div>
<p></head><br>
<body><br>
<div class="navbar"><br>
<ul><br>
<li><br>
<a href="#"><br>
<span class="icon"><i class="fas fa-home"></i></span><br>
<span class="text">Home</span><br>
</a><br>
</li><br>
<li><br>
<a href="#"><br>
<span class="icon"><i class="fas fa-user"></i></span><br>
<span class="text">Profile</span><br>
</a><br>
</li><br>
<li><br>
<a href="#"><br>
<span class="icon"><i class="fas fa-comments"></i></span><br>
<span class="text">Message</span><br>
</a><br>
</li><br>
<li><br>
<a href="#"><br>
<span class="icon"><i class="fas fa-camera"></i></span><br>
<span class="text">Photos</span><br>
</a><br>
</li><br>
<li><br>
<a href="#"><br>
<span class="icon"><i class="fas fa-cog"></i></span><br>
<span class="text">Settings</span><br>
</a><br>
</li><br>
</ul><br>
<div class="indicator"></div><br>
</div></p>
<div class="highlight"><pre class="highlight plaintext"><code><script>
const list = document.querySelectorAll('.navbar ul li');
const indicator = document.querySelector('.indicator');
function activeLink() {
list.forEach((item) =&gt; item.classList.remove('active'));
this.classList.add('active');
// Get the selected item's position
let pos = this.offsetLeft + this.offsetWidth / 2;
// Move indicator to the selected item
indicator.style.opacity = "1";
indicator.style.left = `${pos}px`;
indicator.style.transform = "translateX(-50%) scale(1)";
}
list.forEach((item) =&gt; item.addEventListener('click', activeLink));
</script>
</code></pre></div>
<p></body><br>
</html><br>
`</p>
Top comments (0)