This is an exploration spike of a responsive navbar build with Tailwind CSS 1.0 framework.
This spike focuses on:
- Use a
menu
-button instead of aburger
-button (nngroup does this) — too many people still don't grok that the burger shows the main nav links. - Fallback to
no-javascript
mode — if no javasript is available the navbar expands by default (you won't believe how many sites break at their mainburger-nav
) - Fallback guarantees to look good on all browsers, which support flexbox but disables javascript (no-script plugins etc.) — no such guarantees are made towards obsolete browsers like IE8-11
- Limit the nav's max width with a
container
. - Menu supports (only) one level of depth.
- Simple and modern js for menu toggler — if this breaks, the js detection script probably breaks, too — which is actually fine, because we serve the
no-js
fallback to those ancient IE9/10.
Detect JS with this script:
<!doctype html>
<html class="no-js">
…
<script>document.documentElement.classList.remove("no-js");</script>
</html>