0

I'm trying to make my navbar semitransparent on this code but I'm not able to do it:

 <nav class="navbar navbar-default navbar-fixed-top transparent" >
 <div class="container">
 <div class="container-fluid">
 <!-- 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-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="/">brand</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 class="active"><a href="/">Home <span class="sr-only">(current)</span></a></li>
    <li><a href="/searches">Searches</a></li>
    <li><a href="/contact">Contact</a></li>

   </ul>
   <form class="navbar-form navbar-left" role="search">
    <div class="form-group">
      <input type="text" class="form-control" placeholder="Search">
     </div>
    <button type="submit" class="btn btn-default">Submit</button>
    </form>
    <ul class="nav navbar-nav navbar-right">
     <li class="dropdown">
      <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Legal <span class="caret"></span></a>
       <ul class="dropdown-menu" role="menu">
        <li><a href="/terms">Terms</a></li>
        <li><a href="/dmca">DMCA</a></li>
        <li><a href="/rta">RTA</a></li>
        <li class="divider"></li>
        <li><a href="/contact">Contact</a></li>
amphetamachine
  • 27,620
  • 12
  • 60
  • 72
Ruben Saez
  • 3
  • 1
  • 1
  • 6
  • possible duplicate of [Changing Bootstrap's navbar opacity without affecting the buttons](http://stackoverflow.com/questions/14493405/changing-bootstraps-navbar-opacity-without-affecting-the-buttons) – Paulie_D Feb 27 '15 at 16:45
  • I tried that but didnt work – Ruben Saez Feb 27 '15 at 17:52

3 Answers3

2

Try this in your code, it worked for me -

give an id to the nav

like this-

<nav class="navbar navbar-default navbar-fixed-top transparent" id="nav1">

Then apply this in your css-

#nav1
{  
    background-color:#F00; /*whichever you want*/
    opacity: 0.5; 
    filter:(opacity=50);       
}
Devashish Prasad
  • 1,227
  • 1
  • 13
  • 25
0

in your bootstrap.css find the navbar you are using, for example, if you're using the default navbar search for .navbar-default or .navbar-inverted as per your case and set the opacity simply using the CSS opacity command.

Did the job for me.

Nathan Tuggy
  • 2,237
  • 27
  • 30
  • 38
YaddyVirus
  • 301
  • 4
  • 21
-1

It would be nice to see the orginal CSS.
Paste the css code that shows the opacity.
The way I see your problem I think you did not write the path correct enough so it doesn't overwrite the original css from bootstrap.

<div id="wrapper">
    <div class="container">
        <div class="nav">
            <p>tessssssssssssssst</p>
         <div>
    </div>
</div>

#wrapper .container .nav{  
            background-color: red;
            opacity: 0.3;        
}

#wrapper .nav {
    opacity: 1.0;
}

http://jsfiddle.net/7h4hrvhu/

bummi
  • 27,123
  • 14
  • 62
  • 101
The M
  • 641
  • 1
  • 7
  • 33