Tomáš Nosek
Tomáš Nosek

Reputation: 213

Changing color of navbar link and It's hover

I am working on a website using bootstrap but I was not able to change the color of links and It's hovers in navbar. I can't figure out, where should I put the color statement in CSS.

HTML CODE

 <!-- Navigation -->
     <nav class="navbar navbar-default" role="navigation">
        <div class="container">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
                <a class="navbar-brand" href="index.html">MG STAV stavební, spol. s r.o</a>
            </div>
            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li>
                        <a href="index.html">Domů</a>
                    </li>
                    <li>
                        <a href="about.html">O společnosti</a>
                    </li>
                    <li>
                        <a href="reference.html">Reference</a>
                    </li>
                    <li>
                        <a href="contact.html">Kontakt</a>
                    </li>
                </ul>
            </div>
            <!-- /.navbar-collapse -->
        </div>
        <!-- /.container -->
    </nav>

Upvotes: 0

Views: 197

Answers (2)

m0bi5
m0bi5

Reputation: 9475

Try giving an ID to all your nav's <a> .

<a id = "link"....>..</a>

CSS:

#link{
    color:red; //any other color
}

#link:hover{
    color:black; //any other color
}

Working example:http://jsfiddle.net/joez9apm/

Upvotes: 1

Maki
Maki

Reputation: 637

nav a:-webkit-any-link {
color: red;
}

nav a:hover{
color: green;
}

Upvotes: 1

Related Questions