Most WordPress mega-menu plugins add extra CSS/JS files that slow down your site — and 90% of the time, you don’t even need that much complexity. This tutorial shows how to build a clean, animated navigation menu using pure HTML and CSS, dropped straight into Elementor’s HTML widget. No plugin, no extra page weight, no jQuery.
Live Demo
The HTML Structure
How It Works
- Flexbox layout —
display: flexwithgapkeeps menu items evenly spaced without margin hacks. - The underline animation — the
::afterpseudo-element starts atwidth: 0and expands to100%on hover, powered entirely by a CSStransition. No JavaScript involved. - Brand color on hover — the link color and underline both shift to the accent color, giving instant visual feedback.
- Responsive fallback — on smaller screens,
flex-wrap: wrapstacks the items instead of squeezing them into one row.
How to Add This in Elementor
- Drag an HTML widget onto your section.
- Paste the HTML code above into the widget.
- Go to your theme’s Custom CSS panel (or Elementor’s page-level Custom CSS) and paste the CSS.
- Replace the menu labels and
hreflinks with your own pages. - Adjust
#DF4826to match your own brand color if needed.
Customization Ideas
- Add a dropdown by nesting a
<ul>inside a<li>and showing it with:hover. - Swap the underline for a background-fill animation by animating
background-sizeinstead ofwidth. - Use
clamp()onfont-sizefor smoother scaling across breakpoints instead of a hard media query.
Final Thoughts
A hand-coded menu like this loads instantly, has zero plugin dependency, and gives you full control over the animation — exactly the kind of lightweight approach that keeps Elementor sites fast. If you want this built into your live site with your exact brand styling, feel free to reach out — I build custom Elementor components like this regularly.
