Neon Glow Navigation Menu
Intermediate
A futuristic navigation menu with vibrant neon glow effects, animated borders, and cyberpunk-style aesthetics
Live Preview
Code Implementation
HTML
<nav class="neon-menu">
<div class="menu-container">
<div class="logo">
<span class="logo-text">NEON</span>
<div class="logo-glow"></div>
</div>
<ul class="menu-items">
<li class="menu-item">
<a href="#" class="menu-link">
<span class="link-text">Home</span>
<div class="neon-border"></div>
</a>
</li>
<li class="menu-item">
<a href="#" class="menu-link">
<span class="link-text">About</span>
<div class="neon-border"></div>
</a>
</li>
<li class="menu-item">
<a href="#" class="menu-link">
<span class="link-text">Services</span>
<div class="neon-border"></div>
</a>
</li>
<li class="menu-item">
<a href="#" class="menu-link">
<span class="link-text">Portfolio</span>
<div class="neon-border"></div>
</a>
</li>
<li class="menu-item">
<a href="#" class="menu-link">
<span class="link-text">Contact</span>
<div class="neon-border"></div>
</a>
</li>
</ul>
<div class="power-indicator">
<div class="power-dot"></div>
<span class="power-text">ONLINE</span>
</div>
</div>
<div class="background-grid"></div>
</nav>
CSS
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Orbitron', monospace;
background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
min-height: 100vh;
overflow-x: hidden;
}
.neon-menu {
position: fixed;
top: 20px;
left: 50%;
transform: translateX(-50%);
z-index: 1000;
width: 95%;
max-width: 1200px;
}
.menu-container {
position: relative;
background: rgba(0, 0, 0, 0.8);
backdrop-filter: blur(10px);
border: 2px solid #00ffff;
border-radius: 15px;
padding: 15px 30px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow:
0 0 20px rgba(0, 255, 255, 0.5),
inset 0 0 20px rgba(0, 255, 255, 0.1);
animation: neon-pulse 2s ease-in-out infinite alternate;
}
.background-grid {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
linear-gradient(rgba(0, 255, 255, 0.1) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 255, 255, 0.1) 1px, transparent 1px);
background-size: 20px 20px;
border-radius: 15px;
opacity: 0.3;
pointer-events: none;
}
.logo {
position: relative;
display: flex;
align-items: center;
}
.logo-text {
font-size: 2rem;
font-weight: 900;
color: #00ffff;
text-shadow:
0 0 10px #00ffff,
0 0 20px #00ffff,
0 0 30px #00ffff;
animation: logo-flicker 3s ease-in-out infinite;
}
.logo-glow {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100px;
height: 100px;
background: radial-gradient(circle, rgba(0, 255, 255, 0.3) 0%, transparent 70%);
border-radius: 50%;
animation: logo-glow-pulse 2s ease-in-out infinite;
pointer-events: none;
}
.menu-items {
display: flex;
list-style: none;
gap: 20px;
margin: 0;
padding: 0;
}
.menu-item {
position: relative;
}
.menu-link {
position: relative;
display: block;
color: #ffffff;
text-decoration: none;
font-weight: 700;
font-size: 1rem;
padding: 12px 24px;
border-radius: 8px;
transition: all 0.3s ease;
overflow: hidden;
text-transform: uppercase;
letter-spacing: 1px;
}
.link-text {
position: relative;
z-index: 2;
transition: all 0.3s ease;
}
.neon-border {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
border: 2px solid transparent;
border-radius: 8px;
background: linear-gradient(45deg, #ff0080, #00ffff, #ff0080) border-box;
-webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
-webkit-mask-composite: exclude;
mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
mask-composite: exclude;
opacity: 0;
transition: all 0.3s ease;
animation: border-flow 3s linear infinite;
}
.menu-link:hover {
color: #00ffff;
text-shadow:
0 0 10px #00ffff,
0 0 20px #00ffff;
background: rgba(0, 255, 255, 0.1);
transform: translateY(-2px);
}
.menu-link:hover .neon-border {
opacity: 1;
box-shadow:
0 0 15px rgba(0, 255, 255, 0.8),
inset 0 0 15px rgba(255, 0, 128, 0.3);
}
.menu-link:hover .link-text {
animation: text-glow 0.5s ease-in-out;
}
.power-indicator {
display: flex;
align-items: center;
gap: 8px;
}
.power-dot {
width: 12px;
height: 12px;
background: #00ff00;
border-radius: 50%;
box-shadow:
0 0 10px #00ff00,
0 0 20px #00ff00;
animation: power-blink 1.5s ease-in-out infinite;
}
.power-text {
font-size: 0.8rem;
font-weight: 700;
color: #00ff00;
text-shadow: 0 0 5px #00ff00;
letter-spacing: 2px;
}
@keyframes neon-pulse {
0% {
box-shadow:
0 0 20px rgba(0, 255, 255, 0.5),
inset 0 0 20px rgba(0, 255, 255, 0.1);
}
100% {
box-shadow:
0 0 30px rgba(0, 255, 255, 0.8),
inset 0 0 30px rgba(0, 255, 255, 0.2);
}
}
@keyframes logo-flicker {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.8;
}
75% {
opacity: 1;
}
85% {
opacity: 0.9;
}
}
@keyframes logo-glow-pulse {
0%, 100% {
transform: translate(-50%, -50%) scale(1);
opacity: 0.3;
}
50% {
transform: translate(-50%, -50%) scale(1.2);
opacity: 0.6;
}
}
@keyframes border-flow {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
@keyframes text-glow {
0%, 100% {
text-shadow:
0 0 10px #00ffff,
0 0 20px #00ffff;
}
50% {
text-shadow:
0 0 20px #00ffff,
0 0 30px #00ffff,
0 0 40px #00ffff;
}
}
@keyframes power-blink {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.3;
}
}
@media (max-width: 768px) {
.menu-container {
flex-direction: column;
gap: 20px;
padding: 20px;
}
.menu-items {
gap: 10px;
flex-wrap: wrap;
justify-content: center;
}
.menu-link {
padding: 10px 16px;
font-size: 0.9rem;
}
.logo-text {
font-size: 1.5rem;
}
.neon-menu {
width: 98%;
}
}
@media (max-width: 480px) {
.menu-items {
flex-direction: column;
width: 100%;
}
.menu-link {
text-align: center;
width: 100%;
}
.power-indicator {
justify-content: center;
}
}
JavaScript
document.addEventListener('DOMContentLoaded', function() {
const menuLinks = document.querySelectorAll('.menu-link');
const menuContainer = document.querySelector('.menu-container');
const powerDot = document.querySelector('.power-dot');
// Enhanced hover effects
menuLinks.forEach(link => {
link.addEventListener('mouseenter', function() {
// Create electric spark effect
createElectricSpark(this);
// Add glitch effect to other links
menuLinks.forEach(otherLink => {
if (otherLink !== this) {
otherLink.style.filter = 'brightness(0.5)';
}
});
});
link.addEventListener('mouseleave', function() {
// Remove glitch effect
menuLinks.forEach(otherLink => {
otherLink.style.filter = '';
});
});
// Click effect
link.addEventListener('click', function(e) {
e.preventDefault();
createNeonExplosion(this);
});
});
// Create electric spark effect
function createElectricSpark(element) {
const spark = document.createElement('div');
spark.style.cssText = `
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(45deg, transparent, #00ffff, transparent);
opacity: 0;
pointer-events: none;
border-radius: 8px;
animation: electric-spark 0.3s ease-out;
`;
element.appendChild(spark);
setTimeout(() => {
if (spark.parentNode) {
spark.parentNode.removeChild(spark);
}
}, 300);
}
// Create neon explosion effect
function createNeonExplosion(element) {
const explosion = document.createElement('div');
const rect = element.getBoundingClientRect();
explosion.style.cssText = `
position: fixed;
left: ${rect.left + rect.width / 2}px;
top: ${rect.top + rect.height / 2}px;
width: 100px;
height: 100px;
background: radial-gradient(circle, #00ffff 0%, #ff0080 50%, transparent 100%);
border-radius: 50%;
transform: translate(-50%, -50%) scale(0);
animation: neon-explode 0.6s ease-out;
pointer-events: none;
z-index: 9999;
`;
document.body.appendChild(explosion);
// Create multiple particles
for (let i = 0; i < 8; i++) {
createNeonParticle(rect.left + rect.width / 2, rect.top + rect.height / 2);
}
setTimeout(() => {
if (explosion.parentNode) {
explosion.parentNode.removeChild(explosion);
}
}, 600);
}
// Create neon particles
function createNeonParticle(x, y) {
const particle = document.createElement('div');
const angle = Math.random() * Math.PI * 2;
const velocity = 2 + Math.random() * 3;
const size = 2 + Math.random() * 4;
particle.style.cssText = `
position: fixed;
left: ${x}px;
top: ${y}px;
width: ${size}px;
height: ${size}px;
background: ${Math.random() > 0.5 ? '#00ffff' : '#ff0080'};
border-radius: 50%;
pointer-events: none;
z-index: 9998;
box-shadow: 0 0 10px currentColor;
`;
document.body.appendChild(particle);
let particleX = x;
let particleY = y;
let life = 1;
function animateParticle() {
particleX += Math.cos(angle) * velocity;
particleY += Math.sin(angle) * velocity;
life -= 0.02;
particle.style.left = particleX + 'px';
particle.style.top = particleY + 'px';
particle.style.opacity = life;
particle.style.transform = `scale(${life})`;
if (life > 0) {
requestAnimationFrame(animateParticle);
} else {
if (particle.parentNode) {
particle.parentNode.removeChild(particle);
}
}
}
animateParticle();
}
// Power indicator effects
let powerStatus = true;
setInterval(() => {
if (Math.random() < 0.1) { // 10% chance to flicker
powerDot.style.background = powerStatus ? '#ff0000' : '#00ff00';
powerStatus = !powerStatus;
setTimeout(() => {
powerDot.style.background = '#00ff00';
powerStatus = true;
}, 100);
}
}, 2000);
// Menu container glow intensity based on mouse proximity
document.addEventListener('mousemove', function(e) {
const rect = menuContainer.getBoundingClientRect();
const centerX = rect.left + rect.width / 2;
const centerY = rect.top + rect.height / 2;
const distance = Math.sqrt(
Math.pow(e.clientX - centerX, 2) + Math.pow(e.clientY - centerY, 2)
);
const maxDistance = 300;
const intensity = Math.max(0, (maxDistance - distance) / maxDistance);
menuContainer.style.boxShadow = `
0 0 ${20 + intensity * 30}px rgba(0, 255, 255, ${0.5 + intensity * 0.3}),
inset 0 0 ${20 + intensity * 10}px rgba(0, 255, 255, ${0.1 + intensity * 0.1})
`;
});
// Add CSS animations
const style = document.createElement('style');
style.textContent = `
@keyframes electric-spark {
0% {
opacity: 0;
transform: scaleX(0);
}
50% {
opacity: 1;
transform: scaleX(1);
}
100% {
opacity: 0;
transform: scaleX(0);
}
}
@keyframes neon-explode {
0% {
transform: translate(-50%, -50%) scale(0);
opacity: 1;
}
50% {
transform: translate(-50%, -50%) scale(1);
opacity: 0.8;
}
100% {
transform: translate(-50%, -50%) scale(2);
opacity: 0;
}
}
`;
document.head.appendChild(style);
// Keyboard navigation
let currentIndex = -1;
document.addEventListener('keydown', function(e) {
if (e.key === 'Tab') {
e.preventDefault();
currentIndex = (currentIndex + 1) % menuLinks.length;
menuLinks.forEach((link, index) => {
if (index === currentIndex) {
link.focus();
link.style.background = 'rgba(0, 255, 255, 0.2)';
createElectricSpark(link);
} else {
link.style.background = '';
}
});
}
if (e.key === 'Enter' && currentIndex >= 0) {
createNeonExplosion(menuLinks[currentIndex]);
}
});
// Random background grid flicker
const backgroundGrid = document.querySelector('.background-grid');
setInterval(() => {
if (Math.random() < 0.3) {
backgroundGrid.style.opacity = Math.random() * 0.5 + 0.1;
setTimeout(() => {
backgroundGrid.style.opacity = '0.3';
}, 100);
}
}, 1500);
});