← Back to Bootstrap Course | Chapter 6: Components — Navigation | Lesson 2 of 7

Navbar branding

The brand area shows your logo or name, usually on the left of the navbar.

In this page:

  1. Navbar branding
Syntax
markup
<a class="navbar-brand" href="#">Brand text</a>
<span class="navbar-brand mb-0 h1">Brand text</span>

Navbar branding

Use .navbar-brand on an a element (or span for a non-link). It can hold text, an image sized with width and height attributes, or both. Vertical alignment inside the brand is easiest with .d-inline-block .align-text-top or flex utilities.

Note: Give logo images alt text and explicit dimensions.

Example: Navbar branding

markup
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body class="p-3">
<nav class="navbar bg-body-tertiary">
  <div class="container">
    <a class="navbar-brand d-flex align-items-center gap-2" href="#">
      <svg width="30" height="30" viewBox="0 0 30 30" aria-hidden="true"><circle cx="15" cy="15" r="14" fill="#712cf9"/></svg>
      <span>BrandName</span>
    </a>
  </div>
</nav>
</body>
</html>
Live Example
Related Topics
Common Mistakes
  1. Using a div instead of a link
  2. Huge unsized logo images
  3. Forgetting alt text
Chapter Summary
  • navbar-brand holds text or logo
  • Use a or span
  • Size images explicitly
  • Align with utilities
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.