Open In App

Bootstrap 5 Navbar Brand Text

Last Updated : 23 Dec, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

A navigation bar is used in every website to make it more user-friendly so that the navigation through the website becomes easy and the user can directly search for the topic of their interest. Navbar Brand Text is used to add text in place of the brand logo. We can write text or links using the navbar-brand class.

Navbar Brand Text Class: There is no predefined class to put text in the navbar, we only need to put the text inside of the navbar-brand class used element.

Syntax:

<nav class="navbar navbar-*">
    <div>
           <a class="navbar-brand" href="#">
               Your Navbar Brand Text
           </a>
     </div>
</nav>

Example 1: In this example, we will learn about using a navbar-brand class with links.

HTML




<!DOCTYPE html>
<html lang="en">
 
<head>
    <title>
        Bootstrap 5 Navbar Brand Text
    </title>
    <link href=
          rel="stylesheet"
          integrity=
"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
          crossorigin="anonymous">
</head>
 
<body>
    <div class="container text-center">
        <h1 class="text-success">
            GeeksforGeeks
        </h1>
 
        <h2>Bootstrap 5 Navbar Brand Text</h2>
 
        <nav class="navbar navbar-light bg-success">
            <a class="navbar-brand p-2" href="#">
                GeeksforGeeks
            </a>
        </nav>
    </div>
</body>
 
</html>


Output:

Bootstrap 5 Navbar Brand Text

Example 2: In this example, we will learn about using a navbar-brand class with headings.

HTML




<!DOCTYPE html>
<html lang="en">
 
<head>
    <title>
        Bootstrap 5 Navbar Brand Text
    </title>
    <link href=
          rel="stylesheet"
          integrity=
"sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC"
          crossorigin="anonymous">
</head>
 
<body>
    <div class="container text-center">
        <h1 class="text-success">
            GeeksforGeeks
        </h1>
 
        <h2>Bootstrap 5 Navbar Brand Text</h2>
 
        <nav class="navbar navbar-light bg-success">
            <a class="navbar-brand p-2">
                GeeksforGeeks
            </a>
        </nav>
    </div>
</body>
 
</html>


Output:

Bootstrap 5 Navbar Brand Text

References: https://getbootstrap.com/docs/5.0/components/navbar/#text



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads