Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap change the navbar font-size

I have wasted 2 hours, searching for the solution. I want to change the font size of the navbar and change the font-size even in the media queries. I can change the color not the font and sometimes the font changes size in the col-lg but not in the media-queries


HTML

<nav class="navbar navbar-default">
            <div class="container-fluid">

            <div class="navbar-header">
              <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
              </button>
            </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 class="active"><a href="#">Home<span class="sr-only">(current)</span></a></li>
            <li> <a class="nav-links" href="aboutus.html"><span style="white-space: nowrap">About Us</span></a> </li>
            <li> <a class="nav-links" href="whoweare.html"><span style="white-space: nowrap">Who We Are</span></a> </li>
            <li> <a class="nav-links" href="mission.html">Mission</a> </li>
            <li> <a class="nav-links" href="activities.html">Activities</a> </li>
            <li> <a class="nav-links" href="gallery.html">Gallery</a> </li>
            <li> <a class="nav-links" href="donate.html">Donate</a> </li>
            <li> <a class="nav-links" href="sitemap.html">Sitemap</a> </li>
            <li> <a class="nav-links" href="contactus.html"><span style="white-space: nowrap">Contact Us</span></a> </li>

          </ul>


        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
    </nav>

CSS

 nav {
                width: 100%;
                height: 40px;
                background: -webkit-linear-gradient(#3f9a15, #388813, #3f9a15, #388813, #3f9a15);
                background: -o-linear-gradient(#3f9a15, #388813, #3f9a15, #388813, #3f9a15);
                background: linear-gradient(#3f9a15, #388813, #3f9a15, #388813, #3f9a15);
                border-radius: 6px !important;
                -moz-border-radius: 6px !important;
            }

        .nav a{
            color: white !important;
            font-size: 1.8em !important;
        }
like image 804
am guru prasath Avatar asked Oct 29 '15 00:10

am guru prasath


People also ask

How can I change navbar font color in bootstrap 4?

Changing the text color The text color of the navigation bar can be changed using two inbuilt classes: navbar-light: This class will set the color of the text to dark. This is used when using a light background color. navbar-dark: This class will set the color of the text to light.


1 Answers

Here is a working demo for you considering that you wanted padding-right between links Home and About etc.

For links i have used the css class .nav li

 nav {
     width: 100%;
     height: 40px;
     background: -webkit-linear-gradient(#3f9a15, #388813, #3f9a15, #388813, #3f9a15);
     background: -o-linear-gradient(#3f9a15, #388813, #3f9a15, #388813, #3f9a15);
     background: linear-gradient(#3f9a15, #388813, #3f9a15, #388813, #3f9a15);
     border-radius: 6px !important;
     -moz-border-radius: 6px !important;
        }
.nav a{
    color: white !important;
    font-size: 1.8em !important;
    }
.nav li{
    padding-right:5px;
   }
like image 88
Mike Ross Avatar answered Oct 20 '22 17:10

Mike Ross