You also need to add the class bg-dark
additionally to navbar-dark
.
navbar-dark
basically just determines what color the text should be i.e. light text for a dark-background navbar and dark text for a light-colored navbar.
bg-dark
then determines the actual background-color of the navbar. But other colors would work just as well. For example, bg-primary
or bg-danger
would work well with navbar-dark
.