Customize Bootstrap 4 NAVBAR | CSS only

Customize Bootstrap 4 NAVBAR | CSS only

Today, We're going to customize the Bootstrap 4 NAVBAR. it will be a real quick tutorial because we're just going to add some CSS, so all you need to follow this tutorial, is the very basic knowledge of CSS.

The first thing you'll need is the bootstrap 4 starter template. so go and create an index.html file, open the file with your favorite text editor, and copy/paste the code below.

<!doctype html>
<html lang="en">
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

    <title>Hello, world!</title>
    <h1>Hello, world!</h1>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
    <script src="" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

Remove this line <h1>Hello, world!</h1> and replaced it with the navbar code below.

<nav class="navbar navbar-expand-lg navbar-light bg-light mynav">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>

  <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      <li class="nav-item dropdown">
        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
        <div class="dropdown-menu" aria-labelledby="navbarDropdown">
          <a class="dropdown-item" href="#">Action</a>
          <a class="dropdown-item" href="#">Another action</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="#">Something else here</a>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>

Now in the directory where your index.html file lives, create two folders (css and img), one for css files, and the other for images.

Now right click on this image, and click on save image as ..., and then choose the folder img.

Customize Bootstrap 4 NAVBAR | CSS only

Now inside your css folder, create a new file, style.css
After that, inside the <head> tag, add this line of code <link rel="stylesheet" href="css/style.css"> just after this line <link rel="stylesheet" href="" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">. to link your index.html file to the style.css file.

And now the last thing to do is to copy/paste the code below, inside your style.css file, and everything should be working just fine.

You can see this article in action by watching my tutorial on how to customize the Bootstrap 4 Navbar.


  1. great video. bless

    what is the requirement to be your student ? any place to get your courses ?

You're welcome to share your ideas with us in comments.


Contact Form