-
CSS electric navigation menu animation
HTML
CSS
JavaScript
Home
About
Services
Portfolio
Contact
* { margin: 0; padding: 0; box-sizing: border-box; } body { min-height: 100vh; display: flex; justify-content: center; align-items: center; background: #000; font-family: Arial, sans-serif; } /* Navigation */ .navbar { display: flex; gap: 12px; padding: 15px; background: #10151f; border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.5); } .nav-item { position: relative; padding: 14px 25px; color: #aeb7c8; text-decoration: none; font-size: 15px; font-weight: 600; border-radius: 10px; overflow: hidden; transition: .3s ease; } /* Electric border */ .nav-item::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: conic-gradient( from 0deg, transparent 0deg, transparent 300deg, #00eaff 330deg, #ffffff 345deg, #00eaff 355deg, transparent 360deg ); animation: electric 2s linear infinite; opacity: 0; } /* Inner background */ .nav-item::after { content: ""; position: absolute; inset: 2px; background: #10151f; border-radius: 8px; z-index: 0; } /* Text */ .nav-item span { position: relative; z-index: 2; } /* Hover */ .nav-item:hover { color: #ffffff; transform: translateY(-2px); box-shadow: 0 0 10px #00eaff, 0 0 25px rgba(0,234,255,.45); } .nav-item:hover::before { opacity: 1; } /* Electric movement */ @keyframes electric { from { transform: rotate(0deg); } to { transform: rotate(360deg); } } /* Active menu */ .nav-item.active { color: #fff; background: rgba(0,234,255,.08); } .nav-item.active::before { opacity: 1; }
Live Preview