| class CustomNavbar extends HTMLElement { |
| connectedCallback() { |
| this.attachShadow({ mode: 'open' }); |
| this.shadowRoot.innerHTML = ` |
| <style> |
| :host { |
| display: block; |
| } |
| nav { |
| background: white; |
| padding: 1rem 2rem; |
| box-shadow: 0 2px 10px rgba(0,0,0,0.1); |
| position: sticky; |
| top: 0; |
| z-index: 1000; |
| } |
| .nav-container { |
| max-width: 1200px; |
| margin: 0 auto; |
| display: flex; |
| justify-content: space-between; |
| align-items: center; |
| } |
| .logo { |
| font-size: 1.5rem; |
| font-weight: bold; |
| color: #0891b2; |
| text-decoration: none; |
| } |
| .nav-links { |
| display: flex; |
| gap: 2rem; |
| align-items: center; |
| list-style: none; |
| margin: 0; |
| padding: 0; |
| } |
| .nav-links a { |
| color: #374151; |
| text-decoration: none; |
| font-weight: 500; |
| transition: color 0.3s; |
| } |
| .nav-links a:hover { |
| color: #0891b2; |
| } |
| .cta-btn { |
| background: linear-gradient(135deg, #0891b2, #06b6d4); |
| color: white; |
| padding: 0.75rem 1.5rem; |
| border-radius: 8px; |
| text-decoration: none; |
| font-weight: 600; |
| transition: transform 0.3s, box-shadow 0.3s; |
| } |
| .cta-btn:hover { |
| transform: translateY(-2px); |
| box-shadow: 0 4px 15px rgba(8, 145, 178, 0.4); |
| color: white; |
| } |
| @media (max-width: 768px) { |
| .nav-links { |
| display: none; |
| } |
| } |
| </style> |
| <nav> |
| <div class="nav-container"> |
| <a href="#" class="logo">🦷 BrightSmile Dental</a> |
| <ul class="nav-links"> |
| <li><a href="#home">Home</a></li> |
| <li><a href="#services">Services</a></li> |
| <li><a href="#about">About</a></li> |
| <li><a href="#testimonials">Testimonials</a></li> |
| <li><a href="#contact">Contact</a></li> |
| <li><a href="#contact" class="cta-btn">Book Appointment</a></li> |
| </ul> |
| </div> |
| </nav> |
| `; |
| } |
| } |
| customElements.define('custom-navbar', CustomNavbar); |