snikhilesh's picture
need more latest graphics and animations, I want this to be rich and professional
6943658 verified
class CustomNavbar extends HTMLElement {
connectedCallback() {
this.attachShadow({ mode: 'open' });
this.shadowRoot.innerHTML = `
<style>
nav {
background: white;
padding: 1.5rem;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
position: sticky;
top: 0;
z-index: 100;
}
.logo {
font-weight: bold;
font-size: 1.25rem;
color: #4f46e5;
display: flex;
align-items: center;
}
.logo i {
margin-right: 0.5rem;
}
ul {
display: flex;
gap: 1.5rem;
list-style: none;
margin: 0;
padding: 0;
}
a {
color: #4b5563;
text-decoration: none;
font-weight: 500;
padding: 0.5rem 0;
position: relative;
transition: color 0.2s;
}
a:hover {
color: #4f46e5;
}
a::after {
content: '';
position: absolute;
bottom: 0;
left: 0;
width: 0;
height: 2px;
background-color: #4f46e5;
transition: width 0.3s;
}
a:hover::after {
width: 100%;
}
.mobile-menu {
display: none;
}
@media (max-width: 768px) {
ul {
display: none;
}
.mobile-menu {
display: block;
}
}
</style>
<nav>
<a href="#" class="logo">
<i data-feather="user"></i>
<span>Nikhilesh</span>
</a>
<ul>
<li><a href="#about">About</a></li>
<li><a href="#experience">Experience</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<button class="mobile-menu" aria-label="Menu">
<i data-feather="menu"></i>
</button>
</nav>
`;
}
}
customElements.define('custom-navbar', CustomNavbar);