Skip to content

Mobile bottom tab bar in HTML and CSS

A navigation that sits at the bottom of the screen, under the thumb, on phones, and becomes a horizontal bar at the top on desktop.

Here is an excerpt of this component's code in HTML and CSS. The full code is free for members, ready to copy into your project.

This component also comes in

Open in a new tab

The code in HTML and CSS

index.html
<!doctype html>
<html lang="fr">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Barre d’onglets en bas sur mobile</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <main class="demo">
      <div class="nob" data-nob>
        <header class="nob-top">
script.js
document.querySelectorAll("[data-nob]").forEach((root) => {
  const on = (el, type, fn) => el.addEventListener(type, fn);
  // Anchors stay on the page: mark the tab the visitor chose as the current one.
  root.querySelectorAll("[data-nob-tab]").forEach((tab, _, all) => {
    on(tab, "click", () => {
      all.forEach((other) => other.removeAttribute("aria-current"));
      tab.setAttribute("aria-current", "page");
    });
  });
});
style.css
:root {
  --nob-bg: #fffaf3;
  --nob-text: #2a1d14;
  --nob-muted: #5e4c3e;
  --nob-bar: #ffffff;
  --nob-line: #eadfd2;
  --nob-accent: #b91c1c;
  --nob-active: #fdecec;
  --demo-bg: #f4ede4;
  --demo-text: #2a1d14;
}

Free component: copy it freely, including for commercial projects.

Navigation bars components in HTML and CSS
  • Logo on the left, links in the middle, call to action on the right, collapsible menu on mobile.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • The house name in the middle, links split on each side, restaurant or designer-shop style.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A strip of practical details (phone, opening hours) above the main navigation.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component