Bootstrap 4 navbar-inverse doesn't have colour

Viewed 15875

Recently I decided to try new bootstrap version (4). I did everything right with files (my html below)

<!DOCTYPE html>
<html lang="pl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Bootstrap 4 website</title>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>

    <nav class="navbar navbar-inverse">
        <a href="#">Link1</a>
    </nav>

    <!-- JS scripts here -->
    <script src="js/jquery-3.2.1.min.js"></script>
    <script src="js/popper.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/script.js"></script>
</body>
</html>

but my navbar (navbar-inverse) has no colour. Have You ever seen something similar with Bootstrap 4?

6 Answers

In Bootstrap 4 you want to change the background class the nav tag (.bg-light or .bg-dark).

<nav class="navbar navbar-expand-md bg-dark">

Next you can use navbar-dark to change the color of the text to fit the darker contrast.

Navbar-inverse have property by default. It gives black color of navigation bar . Just change the .navbar-defaultclass into .navbar-inverse

<nav class="navbar navbar-inverse">

   In bootstrap 4 navbar-inverse is replace by navbar-dark. The way it works is, you specify light or dark (via .navbar-light or .navbar-dark)

<nav class="navbar navbar-expand-sm navbar-dark bg-primary">

use this :

<nav class="navbar navbar-expand-sm navbar-dark bg-dark">

Although the answer by @Asia-x3 helps a lot, but steel it does not change the forground color. You can get the same layout as the previouse navbar-inverse by doing the following modification to the <nav> tag class property and adding navbar-dark after bg-dark

<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
Related