AAM
AAM

Reputation: 321

Change color of the text on the navbar using bootstrap

I am trying to change the text color of my navbar to white. However, I could only change the color of the text on the right side (Logout). Not able to change the color of the text on the left.

header.php

<link type="text/css" rel="stylesheet" href="styles//bootstrap.min.css">

        <link type="text/css" rel="stylesheet" href="styles/mediaqueries.css" media="all">
        <link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.4/css/select2.min.css" rel="stylesheet">    
        <script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
          <link rel="stylesheet" href="styles//bootstrap.min_1.css">
        <link rel="stylesheet" href="css/main.css" media="all">
        <link type="text/css" rel="stylesheet" href="styles/mediaqueries.css" media="all">

        <meta http-equiv="content-type" content="text/html; charset=UTF-8">




<div class="mm-page">
            <div class="nav">
                <header id="header" class="full_width clear"> </header>  
                <nav class="navbar navbar-expand-lg navbar-dark navbar-static-top" id="topNav" style="">
                    <a href="index.php" class="navbar-brand"><img src="images/logo.png" alt=" Logo"></a>
                    <div id="container"> 

                        <div class="container-fluid">
                            <div class="collapse navbar-collapse" id="myNavbar">

                            </div>
                            <ul class="nav navbar-nav">
                                <li class="active"</li> <a href="#" class=""><span class=""></span> My Profile</a>
                                <li><a href="#" class=""><span class=""></span> My Portal</a></li>
                                <li><a href="#" class=""><span class=""></span>Contact Us</a></li>
                                <li><a href="#" class=""><span class=""></span>Help</a></li>

                            </ul>
                            <ul class="nav navbar-nav navbar-right">
                                <li><a href="#" class="glyphicon glyphicon-log-out"><span class=""></span> Logout</a></li>
                            </ul>
                        </div>
                    </div>  
                </nav>
            </div>
        </div>

main.css

.nav.navbar-nav.navbar-right li a {
    color: white;
}

.nav.navbar-nav li a{
    color: white;
}

Upvotes: 2

Views: 5952

Answers (2)

Simon
Simon

Reputation: 2538

It's difficult to test without executable code but I think you're missing the !important tag. !important tells css to ignore subsequent rules.

.nav.navbar-nav.navbar-right li a {
    color: white !important;
}

.nav.navbar-nav li a{
    color: white !important;
}

You can read more about !important tags in css here: What does !important in CSS mean?

Upvotes: 0

Elroy Jetson
Elroy Jetson

Reputation: 968

.nav.navbar-nav.navbar-right li a {
    color: white !important;
}

.nav.navbar-nav li a{
    color: white !important;
}

Upvotes: 2

Related Questions