Skip to content

Centered logo navigation in HTML and CSS

The house name in the middle, links split on each side, restaurant or designer-shop style.

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>Navigation à logo centré</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <div class="demo">
      <header class="split-nav" data-nav>
        <div class="split-nav__bar">
nav.js
document.querySelectorAll("[data-nav]").forEach((nav) => {
  const toggle = nav.querySelector("[data-nav-toggle]");
  const setOpen = (open) => {
    nav.toggleAttribute("data-open", open);
    toggle.setAttribute("aria-expanded", String(open));
  };
  toggle.addEventListener("click", () => setOpen(!nav.hasAttribute("data-open")));
  nav.addEventListener("keydown", (event) => {
    if (event.key === "Escape" && nav.hasAttribute("data-open")) {
      setOpen(false);
      toggle.focus();
    }
style.css
:root {
  --split-bg: #f7f3ec;
  --split-line: #d9cfbf;
  --split-text: #2b241b;
  --split-muted: #6b5d4a;
  --split-ring: #2b241b;
  --demo-bg: #f7f3ec;
  --demo-text: #2b241b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {

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

Navigation bars components 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.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Logo on the left, links in the middle, call to action on the right, collapsible menu on mobile.

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

    • Tailwind
    • React
    • CSS
    • WordPress
    Component