Why isn't my button style changing? - html

I am trying to do a custom button style in my navbar in bootstrap but it's taking on the default styles of the navbar. What I am trying to do is make two buttons in the navbar that say sign up and login. I want them to be in-line with the rest of the menu items but to be "buttons" that have a border with no background. Yet they appear with the btn-primary coloring.
This is the code I am using:
.btn.outline {
background: none !important;
padding: 12px 12px;
}
.btn-primary.outline {
border: 2px solid #0099cc;
color: #0099cc;
}
.btn-primary.outline:hover, .btn-primary.outline:focus, .btn-primary.outline:active, .btn-primary.outline.active, .open > .dropdown-toggle.btn-primary {
color: #33a6cc;
border-color: #33a6cc;
}
.btn-primary.outline:active, .btn-primary.outline.active {
border-color: #007299;
color: #007299;
box-shadow: none;
}
I call to it like this:
<li>
<p class="navbar-btn">
Sign Up
</p>
</li>
Can anyone spot what I am doing or missing causing it to ignore my CSS?
Thanks!
Edit: I used the !important in hopes it would override the bootstrap.css
Edit again: here's my navbar code:
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<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>
<a class="navbar-brand" href="#home"><img src="Landing/img/logo3.png" class="img-responsive2"></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav pull-right mainnav">
<li>
About
</li>
<li>
Services
</li>
<li>
Contact
</li>
<li>
<p class="navbar-btn">
Sign Up
</p>
</li>
<li>
<p class="navbar-btn">
Login
</p>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>

Looks like it's working to me using BS 3.3.4.
I grabbed the default navbar code from the BS website and placed yours into it. Check this fiddle - it's a button with no background and a blue border.
Perhaps you have some things in the wrong place?
<style>
.btn.outline {
background: none !important;
padding: 12px 12px;
}
.btn-primary.outline {
border: 2px solid #0099cc;
color: #0099cc;
}
.btn-primary.outline:hover, .btn-primary.outline:focus, .btn-primary.outline:active, .btn-primary.outline.active, .open > .dropdown-toggle.btn-primary {
color: #33a6cc;
border-color: #33a6cc;
}
.btn-primary.outline:active, .btn-primary.outline.active {
border-color: #007299;
color: #007299;
box-shadow: none;
}
</style>
<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>
<a class="navbar-brand" href="#">Brand</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<p class="navbar-btn">
Sign Up
</p>
</li>
</ul>
</div>
</div>
</nav>

Related

Menu element appears at the bottom

I am using Bootstrap to show a nav-bar:
As you may see in the screenshot, the first menu element appears at the bottom, not at the same height as the others menu elements.
Here is the CSS and HTMl code:
CSS
<style>
body {
font-family: 'Roboto', serif;
font-size: 16px;
}
#portada {
background-color: #F1F7F8;
}
.navbar-default .navbar-nav > li > a:hover, .navbar-default .navbar-nav > li > a:focus {
color: #4496B0; /*Sets the text hover color on navbar*/
}
.navbar-default .navbar-nav > .active > a, .navbar-default .navbar-nav > .active >
a:hover, .navbar-default .navbar-nav > .active > a:focus {
color: white; /*BACKGROUND color for active*/
background-color: #4496B0;
}
.navbar-default {
background-color: #94C3D2;
border-color: #4496B0;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
color: #262626;
text-decoration: none;
background-color: #66CCFF; /*change color of links in drop down here*/
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: silver; /*Change rollover cell color here*/
}
.navbar-default .navbar-nav > li > a {
color: white; /*Change active text color here*/
}
.navbar-brand {
padding: 0px;
}
.navbar-brand>img {
height: 68px;
padding: 7px 15px;
width: 180px;
}
</style>
HTML
<div class="bs-example">
<nav role="navigation" class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header navbar-brand">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><img src="imagenes/logo_pleca.png" alt="Vico">
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li >Inicio</li>
<li class="active">Doctores</li>
<li>Hospitales</li>
<li>Farmacias</li>
<li>Laboratorios</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Contactar</li>
<li>Login</li>
</ul>
</div>
</nav>
</div>
I am not able to find a solution for this issue.
Close </a> image
<div class="bs-example">
<nav role="navigation" class="navbar navbar-default">
<div class="navbar-header navbar-brand">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><img src="imagenes/logo_pleca.png" alt="Vico"></a>
</div>
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li>Inicio</li>
<li class="active">Doctores</li>
<li>Hospitales</li>
<li>Farmacias</li>
<li>Laboratorios</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Contactar</li>
<li>Login</li>
</ul>
</div>
</nav>
</div>
Check this fiddle Fiddle
Few tag missing check HTML code:
<div class="bs-example">
<nav role="navigation" class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header navbar-brand">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html"><img src="imagenes/logo_pleca.png" alt="Vico"></a>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Inicio</li>
<li>Doctores</li>
<li>Hospitales</li>
<li>Farmacias</li>
<li>Laboratorios</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>Contactar</li>
<li>Login</li>
</ul>
</div>
</div>
</nav>
</div>
Problem is <a class="navbar-brand" href="index.html"><img src="imagenes/logo_pleca.png" alt="Vico"> there is no closing anchor tag which is the reason for improper layout.
It should be
<a class="navbar-brand" href="index.html">
<img src="imagenes/logo_pleca.png" alt="Vico">
</a>
</div>
Demo : https://jsfiddle.net/yn2xeq6z/

Angular 2 Responsive Header - Expand/toggle button not working in mobile view

The toggle button appears in mobile view but it's not clickable. In angular appDropdown is used to define a drop down button. Is there a similar approach to fix the toggle button?
Unfortunately I cannot show images here but there's another problem with "Administration" drop down button. It changes colour to grey when I hover over the internal <li> (such as "Registration"...).
Adding href= "#" removes the unwanted color change but this refreshes the whole page when its clicked.
Here's the HTML:
<nav class="navbar navbar-webmaster">
<div class="container">
<div class="navbar-header">
<button type="button" appDropdown class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" [routerLink]="['/']">Title</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<ul class="nav navbar-nav navbar-right">
<li class="active">Sublime<span class="sr-only"></span></li>
<li class="dropdown" appDropdown *ngIf="userService.isAdmin">
<a class="dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false">Administration <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a [routerLink]="['/register']">Registration</a></li>
<li><a>Other Admin Stuff</a></li>
<li role="separator" class="divider"></li>
<li><a>Another Admin Stuff</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-right search-form" role="search">
<input type="text" class="form-control" placeholder="Search" />
</form>
</div>
</div>
The CSS:
nav.navbar-webmaster {
background: #00547E;
}
nav.navbar-webmaster a {
color: #fff;
}
nav.navbar-brand :hover {
color: #337ab7;
}
nav.navbar-webmaster ul.navbar-nav a:hover,
nav.navbar-webmaster ul.navbar-nav a:visited,
nav.navbar-webmaster ul.navbar-nav a:focus,
nav.navbar-webmaster ul.navbar-nav a:active {
background: #0d3a51;
}
nav.navbar-webmaster ul.navbar-nav a:hover {
border-color: #337ab7;
}
nav.navbar-webmaster li.divider {
background: #ccc;
}
nav.navbar-webmaster button.navbar-toggle {
background: #999;
border-radius: 2px;
}
nav.navbar-webmaster button.navbar-toggle:hover {
background: #999;
}
nav.navbar-webmaster button.navbar-toggle>span.icon-bar {
background: #fff;
}
nav.navbar-webmaster ul.dropdown-menu {
border: 0;
background: #fff;
}
nav.navbar-webmaster ul.dropdown-menu>li>a {
color: #444;
}
nav.navbar-webmaster ul.dropdown-menu>li>a:hover {
background: #00547E;
color: #fff;
}
Any help is greatly appreciated.
Implemented by using ng-bootstrap. Update html as below
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" (click)="isCollapsed = !isCollapsed" [attr.aria-expanded]="!isCollapsed" aria-controls="myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Logo</a>
</div>
<div class="collapse navbar-collapse" id="myNavbar" [ngbCollapse]="isCollapsed">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Projects</li>
<li>Contact</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><span class="glyphicon glyphicon-log-in"></span> Login</li>
</ul>
</div>
</div>
</nav>
Declare below variable in component class
public isCollapsed = false;
For live action, visit my Plunker

Bootstrap 3 re-order the layout of navbar in small screen

Currently I'm learning Bootstrap 3 and I need help with re-order the layout of navbar in small screen.
I've followed the example in LINK
I've replaced Default / Static / Fixed with user profile
So what I want to change is when the screen is small I will have
|---------- BRAND ----------|
|[-]----------------------profile|
Here is my sample code:
#media (max-width: 767px) {
.navbar-brand {
width: auto;
float: none;
border-bottom: 0 solid transparent;
margin: 0 -15px;
}
.navbar-toggle {
float: left;
}
.nav-user-profile .navbar-nav {
margin: 0;
}
.nav-user-profile .navbar-nav>li {
position: static;
float: left;
}
.nav-user-profile .navbar-nav>li>a {
padding-top: 15px;
padding-bottom: 15px;
line-height: 20px;
}
}
<nav role="navigation" class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-brand">Brand</div>
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
</ul>
<div class="nav-user-profile navbar-right">
<ul class="nav navbar-nav">
<li>Profile</li>
</ul>
</div>
</div>
</nav>
How can I achieve it?
Thanks for ideas
I think this is what you're trying to do based on your diagram. Probably the simplest way to go is to create a div above the navbar for a second brand location. You can hide one or the other brand location with a hidden/visible class. And the profile link can be placed inside the navbar-header so it's visible across all viewports, it just needs to be positioned correctly on the right and the navbar-toggle floated to the left.
See working Snippet.
header {
text-align: center;
background: #f5f5f5;
width: 100%;
height: 50px;
padding: 15px 15px;
}
header .header-brand {
color: #777;
font-size: 18px;
line-height: 20px;
}
header .header-brand:focus,
header .header-brand:hover {
text-decoration: none;
color: #5e5e5e;
}
.navbar .btn.profile-btn,
.navbar .btn.profile-btn:hover,
.navbar .btn.profile-btn:focus {
float: right;
right: 0;
position: absolute;
margin-top: 10px;
background: none;
border: none;
}
#media (max-width: 767px) {
.navbar .navbar-toggle {
float: left;
margin-left: 15px;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<header class="visible-xs-block"> <a class="header-brand" href="#">Brand</a>
</header>
<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-nav" 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> <a class="navbar-brand hidden-xs" href="#">Brand</a>
<button type="button" class="btn btn-default profile-btn">Profile</button>
</div>
<div class="collapse navbar-collapse" id="bs-nav">
<ul class="nav navbar-nav navbar-left">
<li class="active">Home
</li>
<li>About
</li>
<li>Contact
</li>
</ul>
</div>
</div>
</nav>
I only added text-right very simple look where I noted with //changes*
<nav role="navigation" class="navbar navbar-default">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-brand">Brand</div>
<div class="navbar-header">
<button type="button" data-target="#navbarCollapse" data-toggle="collapse" class="navbar-toggle">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collection of nav links and other content for toggling -->
<div id="navbarCollapse" class="collapse navbar-collapse">
//changes*
<ul class="nav navbar-nav text-right">
//changes*
<li class="active">Home</li>
<li>About</li>
<li>Contact</li>
</ul>
<div class="nav-user-profile navbar-right">
<ul class="nav navbar-nav">
<li>Profile</li>
</ul>
</div>
</div>
</nav>
pull-right class may help you...
or
bootstrap is divided to 12 columns for large, medium and small size
So when it breaks into small size give brand to full 12 columns using col-sm-12 class so it will break profile to down

<div> in navbar not aligning properly

I'm using the basic bootstrap css with nothing altered, and I have the following html in a Razor View in ASP.NET MVC:
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<!--<span class="icon-bar"></span>-->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
#Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { #class = "navbar-brand" })
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
#if (ViewBag.WidgetPages != null)
{
foreach (WidgetPage page in ViewBag.WidgetPages)
{
<li class="navbar-collapse"><div>
#page.Title
<span class="glyphicon glyphicon-pencil" role="button"></span>
<span class="glyphicon glyphicon-remove" role="button"></span>
</div>
</li>
}
}
<li><a href="#Url.Action("Create", "WidgetPage")">
<span class="glyphicon glyphicon-plus"></span>
</a>
</li>
</ul>
#Html.Partial("_LoginPartial")
</div>
</div>
</nav>
All my navigation links are working just as they should - however, the alignment of the navigation bar is off from what I expect and want. What I'm ending up with is http://puu.sh/kN0NJ/ea996c060b.png, and what I'm hoping to get is simply all of the items aligned on the same line.
Update: I have the following CSS in my content folder:
.navbar.navbar-edit .navbar-nav li.edited .edit-link a {
color: #fff;
}
.navbar.navbar-edit .navbar-nav li.edited .edit-link a:hover {
color: #ccc;
}
.navbar.navbar-edit .navbar-nav li.edited a {
display: inline-block;
position: relative;
padding-right: 4px;
padding-left: 4px;
}
.navbar.navbar-edit .navbar-nav .edit-link{
padding-left: 4px;
padding-right: 4px;
}
#media (max-width: 767px){
.navbar.navbar-edit .navbar-nav li.edited a{
padding-left: 15px;
}
}
with the following Razor View code:
<nav class="navbar navbar-inverse navbar-edit navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<!--<span class="icon-bar"></span>-->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
#Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { #class = "navbar-brand" })
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
#if (ViewBag.WidgetPages != null)
{
foreach (WidgetPage page in ViewBag.WidgetPages)
{
<li class="edited">
#page.Title
<span class="edit-link"><a href="#Url.Action("Edit", "WidgetPage", new { id = #page.Id })" class="navbar-link">
<span class="glyphicon glyphicon-pencil" role="button"></span></a></span>
<span class="edit-link">
<a href="#Url.Action("Delete", "WidgetPage", new { id = #page.Id })" class="navbar-link">
<span class="glyphicon glyphicon-remove" role="button"></span>
</a>
</span>
</li>
}
}
<li>
<a href="#Url.Action("Create", "WidgetPage")">
<span class="glyphicon glyphicon-plus"></span>
</a>
</li>
</ul>
</div>
#Html.Partial("_LoginPartial")
</div>
</nav>
but I'm still ending up with the stacked buttons. I'm really at a loss here for what is happening.
Your HTML structure is off (unless you're trying to do something outside of the defaults or maybe a dropdown?). Docs
You have navbar-collapse twice and multiple href's inside one li element.
UPDATE:
You can add a custom class to the list items with Icons inside them to adjust the padding and then use media queries to have them remain inline on mobile viewports.
See updated example.
/**BELOW NOT REQUIRED, ONLY FOR CONTEXT**/
.navbar.navbar-custom li.edit span {
color: #eee;
}
.navbar.navbar-custom li.edit span:hover {
color: #ccc;
}
/**ABOVE NOT REQUIRED, ONLY FOR CONTEXT**/
#media (min-width: 768px) {
.navbar.navbar-custom li.edit a {
padding-left: 4px;
padding-right: 4px;
}
}
#media (max-width: 767px) {
.navbar.navbar-custom li.edit {
display: table-cell;
}
.navbar.navbar-custom li.edit a {
padding-right: 4px;
}
}
/**UPDATED NAVBAR RULES - LOOP**/
/**BELOW NOT REQUIRED, ONLY FOR CONTEXT**/
.navbar.navbar-edit .navbar-nav li.edited .edit-link a {
color: #fff;
}
.navbar.navbar-edit .navbar-nav li.edited .edit-link a:hover {
color: #ccc;
}
/**ABOVE NOT REQUIRED, ONLY FOR CONTEXT**/
.navbar.navbar-edit .navbar-nav li.edited a {
display: inline-block;
position: relative;
padding-left: 4px;
padding-right: 4px;
}
.navbar.navbar-edit .navbar-nav .edit-link {
padding-left: 4px;
padding-right: 4px;
}
#media (max-width: 767px) {
.navbar.navbar-edit .navbar-nav li.edited a {
padding-left: 15px;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-inverse navbar-custom">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-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-1">
<ul class="nav navbar-nav">
<li class="edit">This is a Title
</li>
<li class="edit"><span class="glyphicon glyphicon-pencil" role="button"></span>
</li>
<li class="edit"><span class="glyphicon glyphicon-remove" role="button"></span>
</li>
<li>
<a href="#Url.Action(" Create ", "WidgetPage ")">
<span class="glyphicon glyphicon-plus"></span>
</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<hr>
<div class="alert alert-info">
<h3>Updated NAVBAR</h3>
</div>
<nav class="navbar navbar-inverse navbar-edit">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-2" 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-2">
<ul class="nav navbar-nav">
<li class="edited">This is a Title
<span class="edit-link"><a href="#" class="navbar-link"><span class="glyphicon glyphicon-pencil" role="button"> </span>
</a>
</span> <span class="edit-link"><a href="#" class="navbar-link"><span class="glyphicon glyphicon-remove" role="button"></span>
</a>
</span>
</li>
<li>
<a href="#"> <span class="glyphicon glyphicon-plus"></span>
</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>

Changing the color of the links in my bootstrap navbar

I have this code for my navbar:
<nav class="navbar navbar-fixed-top" id="my-navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img style ="max-width:100px; margin-top: -7px;" src="images/firma-Edgar-Ayales.png" alt="">
</div><!--End navbar-header-->
<div class="collapse navbar-collapse navbar-right" id="navbar-collapse">
<ul class="nav navbar-nav">
<li>Feedback
<li>Gallery
<li>Features
<li>Faq
<li>ContactUs
</ul>
</div>
</div><!-- End container -->
And I want to change the links color, I tried this in my css:
.navbar {
background: rgba(0,0,0,0.4);
font-family: "Raleway";
font-size:10pt;
letter-spacing: 3pt;
color: black;
}
I also tried adding !important but I can't make it.
<nav class="navbar navbar-fixed-top" id="my-navbar">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<img style ="max-width:100px; margin-top: -7px;" src="images/firma-Edgar-Ayales.png" alt="">
</div><!--End navbar-header-->
<div class="collapse navbar-collapse navbar-right" id="navbar-collapse">
<ul class="nav navbar-nav" id="links">
<li>Feedback
<li>Gallery
<li>Features
<li>Faq
<li>ContactUs
</ul>
</div>
</div><!-- End container -->
CSS:
#links a{
color:#000000;
font-size:18px;
}
I just added id="links" to the ul, and then referenced the a's in that with CSS
You need to make your css more specific, color applied by bootstrap is on a. So overriding rule will be:
.navbar-nav > li >a{
color:black;
}
to override the default rule applied by bootstrap on anchor:
a {
color: #337ab7;
text-decoration: none;
}
Pen
This makes sure that this color is applied only to the anchor which is direct descendant of li which is direct descendant of .navbar-nav. In order to apply globally (all hyperlinks in your webpage), You could as well override by doing a{color:black}. You also need to make sure you are loading your css after bootstrap so that that takes the precedence over bootstrap. Avoid using !important it will destroy any cascadeability of the css and will prevent any overriding later on.
Here is a possible solution" https://jsfiddle.net/99x50s2s/52/
CSS:
.nav>li>a{
background: rgba(0,0,0,0.4);
font-family: "Raleway";
font-size:10pt;
letter-spacing: 3pt;
color: black;
}