Navbar brand

Bootstrap 5 Navbar brand component

Responsive Navbar brand built with Bootstrap 5. Examples of responsive navbar brands include the image, the icon, in center or a background color.


Basic example

Use .navbar-brand to get a brand.

The .navbar-brand can be applied to most elements, but an anchor works best, as some elements might require utility classes or custom styles.

        
            
                <!-- Navbar -->
                <nav class="navbar navbar-expand-lg bg-body-tertiary navbar-light">
                    <!-- Container wrapper -->
                    <div class="container-fluid">
                        <!-- Navbar brand -->
                        <a class="navbar-brand" href="#">Brand</a>
                    </div>
                    <!-- Container wrapper -->
                </nav>
                <!-- Navbar -->
                
        
    

Image and text

Adding images to the .navbar-brand will likely always require custom styles or utilities to properly size.

        
            
                <!-- Image and text -->
                <nav class="navbar navbar-light bg-body-tertiary">
                    <div class="container-fluid">
                        <a class="navbar-brand" href="#">
                            <img src="https://mdbcdn.b-cdn.net/img/logo/mdb-transaprent-noshadows.webp" class="me-2" height="20" alt="MDB Logo" loading="lazy" />
                            <small>MDBootstrap</small>
                        </a>
                    </div>
                </nav>
                
        
    


Icon and text

You can place icons in .navbar-brand using the CSS Prefix fa and the icon's name. Icons are designed to be used with inline elements (we like the <i> tag for brevity, but using a <span> is more semantically correct).

        
            
                <!-- Icon and text -->
                <nav class="navbar navbar-light bg-body-tertiary">
                    <div class="container-fluid">
                        <a class="navbar-brand mt-lg-0" href="#"> <i class="fas fa-icons me-2"></i><small>MDBootstrap</small> </a>
                    </div>
                </nav>
                
        
    

In center

Add .d-flex, .justify-content-between and .flex-row next to the .container-fluid, create a 3 div, in the 2nd (middle) put .navbar-brand to center the brand.

        
            
                <!-- Navbar -->
                <nav class="navbar navbar-expand-lg bg-body-tertiary navbar-light">
                    <!-- Container wrapper -->
                    <div class="container-fluid d-flex justify-content-between flex-row">
                        <div>
                            <!-- Toggle button -->
                            <button data-mdb-button-init class="navbar-toggler" type="button" data-mdb-collapse-init data-mdb-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                                <i class="fas fa-bars"></i>
                            </button>

                            <!-- Collapsible wrapper -->
                            <div class="collapse navbar-collapse" id="navbarSupportedContent">
                                <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                                    <!-- Link -->
                                    <li class="nav-item">
                                        <a class="nav-link" href="#">Link</a>
                                    </li>

                                    <!-- Dropdown -->
                                    <li class="nav-item dropdown">
                                        <a data-mdb-dropdown-init class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
                                            Dropdown
                                        </a>
                                        <!-- Dropdown menu -->
                                        <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                                            <li>
                                                <a class="dropdown-item" href="#">Action</a>
                                            </li>
                                            <li>
                                                <a class="dropdown-item" href="#">Another action</a>
                                            </li>
                                            <li>
                                                <hr class="dropdown-divider" />
                                            </li>
                                            <li>
                                                <a class="dropdown-item" href="#">Something else here</a>
                                            </li>
                                        </ul>
                                    </li>
                                </ul>
                            </div>
                        </div>

                        <div>
                            <!-- Navbar brand -->
                            <a class="navbar-brand" href="#">
                                <img src="https://mdbcdn.b-cdn.net/img/logo/mdb-transaprent-noshadows.webp" height="17" alt="MDB Logo" loading="lazy" />
                            </a>
                        </div>

                        <div>
                            <!-- Icons -->
                            <ul class="navbar-nav d-flex flex-row me-1">
                                <li class="nav-item me-3 me-lg-0">
                                    <a class="nav-link" href="#"><i class="fas fa-shopping-cart"></i></a>
                                </li>
                                <li class="nav-item me-3 me-lg-0">
                                    <a class="nav-link" href="#"><i class="fab fa-twitter"></i></a>
                                </li>
                                <li class="nav-item me-3 me-lg-0 d-flex align-items-center">
                                    <!-- Avatar -->
                                    <div class="dropdown">
                                        <a data-mdb-dropdown-init class="dropdown-toggle d-flex align-items-center hidden-arrow" href="#" id="navbarDropdownMenuAvatar" role="button" data-mdb-toggle="dropdown" aria-expanded="false">
                                            <img src="https://mdbcdn.b-cdn.net/img/new/avatars/2.webp" class="rounded-circle" height="25" alt="Black and White Portrait of a Man" loading="lazy" />
                                        </a>
                                        <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownMenuAvatar">
                                            <li>
                                                <a class="dropdown-item" href="#">My profile</a>
                                            </li>
                                            <li>
                                                <a class="dropdown-item" href="#">Settings</a>
                                            </li>
                                            <li>
                                                <a class="dropdown-item" href="#">Logout</a>
                                            </li>
                                        </ul>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <!-- Container wrapper -->
                </nav>
                <!-- Navbar -->

                
        
    

Background color

Theming the navbar has never been easier thanks to the combination of theming classes and background-color utilities. Choose from .navbar-light for use with light background colors, or .navbar-dark for dark background colors. Then, customize with .bg-* utilities.

See also our color docs to learn more about colors.

        
            

                <nav class="bg-primary navbar-dark">...</nav>

                <nav class="bg-secondary navbar-dark">...</nav>

                <nav class="bg-success navbar-dark">...</nav>

                <nav class="bg-danger navbar-dark">...</nav>

                <nav class="bg-warning navbar-light">...</nav>

                <nav class="bg-info navbar-light">...</nav>

                <nav class="bg-body-tertiary navbar-light">...</nav>

                <nav class="bg-dark navbar-dark">...</nav>