Bootstrap 3 dropdown menus - html

I'm new to Bootstrap/PHP, so please be gentle :-)
The code is as follows:
<div class = "navbar navbar-inverse navbar-fixed-bottom">
<div class = "container">
<p class = "navbar-text pull-left">Copyright 2014 by ABC</p>
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
Support<b class = "caret"></b>
<ul class = "nav navbar-nav navbar-right dropdown-menu">
<li>Help</li>
<li>FAQ</li>
<li>How To</li>
</ul>
</li>
</ul>
</div>
</div>
This creates a navbar on the bottom of the page with a drop-up menu.
The navbar has an inverse colour, so the text has been set to white to maximise the contrast.
Unfortunately the result is white text on a white background when attempting to select from the menu.
My guess is that I need to override Bootstrap's CSS, but I'm not sure what to override.
And I would prefer not to screw with Bootstrap's CSS file just in case I blow everything.
Many thanks

You have overridden link color by adding an inline style style="color: #ffffff;". This is a bad practice as it’ll take precedence on all other declarations to this element (:hover, :active, …).
If you want to change Bootstrap defaults, you should better do it in a separated CSS file. In this case the style would be:
.navbar-inverse .navbar-nav>li>a {
color: white;
}
You have extra classes on your dropdown
<ul class="nav navbar-nav navbar-right dropdown-menu">
It should be
<ul class="dropdown-menu">
You can see the result here.

The above ans, by LeBen is pretty much fine. But, while working on Bootstrap, keep an eye while overriding Bootstrap CSS. You can easily play it first in Firebug then override, and place a common comment with its description so you can easily make it out. And, while overriding make sure it wont affect the other part in the project, so think before overriding it

Related

Is there a way to change the color of text on hover with inline css?

I have the code below for my nav bar. I want the text in the "Download Freebies" item to change color when the mouse is hovered over it. I am only editing an existing template and there's some css already written for it in the style sheet (for "single-freebie" and "freebie-box"). What can I add (and where) to make the text "Download Freebies" change color to blue when the mouse is hovered over it.
PS: I've already tried the ":hover" and maybe one or two other "solutions" I found online. The color isn't changing and the border of the "Download Freebies" instead jumps upwards or sideways when hovered. I know I am doing something wrong but can't figure out what it is. I am happy to post more code if you specifically request anything you want to look at for me.
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li >Home</li>
<li>About</li>
<li>Download Freebies</li>
<li><div class="single-freebie">
Upload resources</li>
<li>
</li>
</ul><!-- / ul -->
</div><!-- /.navbar-collapse -->
You can use this or you can use JavaScript. I think both will meet your needs.
<li ><a href="index.html"
onMouseOver="this.style.color='#000'"
onMouseOut="this.style.color='#333'">Home</a></li>
<li><a href="about.html"
onMouseOver="this.style.color='#000'"
onMouseOut="this.style.color='#333'">About</a></li>

Toggle between content with Bootstrap

I am using Twitter Bootstrap.css.
I have a top navigation bar which will normally show a menu with hover-over popup for sub items.
But when the collapsed is set due to #media constraints, I want to show the content as nested <select> and <Option> elements.
Clicking the menu button will show content like this:
I am not sure how to perform an inverse collapse. I have tried collapse, collapse.in, etc. styles.
I want to show one content when collapsed and another if not collapsed. Both content areas need to show in the navbar area.
I would like to do pure CSS with no javascript.
The following is the HTML I want to hide when callapsed. I have not created the HTML with the select/option tags yet.
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav" ng-if="userData.isAdminUser" style="cursor: pointer;">
<li class="dropdown">
<a>Managment</a>
<ul class="dropdown-menu">
<li>Employees</li>
<li>Groups</li>
<li>Products</li>
<li>Skills</li>
<li>Levels</li>
</ul>
</li>
</ul>
</div>

Cannot change li background on hover (in bootstrap navbar)?

I think Bootstrap is very hard to understand and override using CSS overriding rule (I don't really want to create my own custom Bootstrap CSS because really it's not very flexible, just one small change will require us to rebuild a new version of Bootstrap from the LESS source code).
What I want here is just simple that when hovering on a link (in a navbar), change its background to my own color, not the ugly default color Bootstrap sets. So even when I define an Id for my link element, CSS rule still does not work at all.
li#li#li#li#li#li#li#li:hover {
background-color:red!important;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="navbar" id="menu">
<ul class="nav navbar-nav">
<li id="li">Test</li>
</ul>
</div>
As you can see even with that CSS rule, it cannot be overridden? Or I'm wrong with the actual element whose background is changed on hovering (while I think it should be actually the li element)?
Also I'm wondering if someone could explain to me by how Bootstrap could make that magic happen. I would like to apply that same magic in my own CSS plugin, it may be helpful in some case.
it's the a link element that's getting that background
#li:hover a {
background-color:red;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="navbar" id="menu">
<ul class="nav navbar-nav">
<li id="li">Test</li>
</ul>
</div>

Changing The Width and Look of Bootstrap Nav-Pills

I have a navigation bar set up using nav-pills. I have the bar horizontal and justified, so they all line up nicely, but I want to change the width of the nav-pills so that I can make them more even with the everything else on the website. Here is my code for the navigation bar:
<div class="container" id="buttonBar">
<ul class="nav nav-pills nav-justified">
<li class="active">HOME</li>
<li>ABOUT</li>
<li>VIDEO</li>
<li>PHOTOGRAPHY</li>
<li>ARTIST PORTFOLIOS</li>
</ul>
</div>
On a custom CSS file I made, I tried doing the following:
.nav .nav-pills .nav-justified li a {
width: 50px;
}
But to no avail. What would be the right way for me to do this? And could anyone also tell me how to change the color of both the text and the color of the nav-pill? I want to make the background color transparent.
Your CSS selector is incorrect. The space between the first three classes means that they are children, and not that the element has all three classes.
Try this instead :
.nav.nav-pill.nav-justified li a {
width: 50px;
}
If you can't get it to work, a fiddle or something would be useful.

Bootstrap - different 100% width menu

I want to make 100% width sub-menu. This should not be 100% of navbar width but 100% of width page. I'm trying to setup this but I can't manage this to work. Is there any way to style ul.sub-menu as 100% width of page?
There is many solution for 100% width but it's always 100% of navbar width not page.
This is an image showing whant I try to achive. If you click for example contact and contact have sub menu, sub menu shows on whole width page.
Thx for all kind of help.
You can use 2 static top nav bars for this, without adding them to your .col-sx-12
The top one will need margin-bottom: 0; added to it.
Make sure you change the data-target of each collapse button.
data-target=".navbar-collapse-1"
and
data-target=".navbar-collapse-2"
respectively. These classes also need added to the appropriate div, per the fiddle.
Fiddle:
Example
I was not able to get this working completely. I ended up settling for using data-toggle with a target ul. Sorry for all the junk in the markup but the primary parts of the code are the data-toggle="collapse" and data-target="#menu*" attributes. There are two submenus under "Courses & Rates" and "Clubs & Leagues" both divs are 100% width and the child uls have .container. Of course you can't have a parent container for the nav.
<!-- primary nav -->
<ul class="nav navbar-nav navbar-right primary">
<li class="dropdown">
Courses & Rates <b class="caret"></b>
<div class="collapse no-transition" id="menu1">
<ul class="container">
<li>Elmwood Golf Course</li>
<li>Prairie Green Golf Course</li>
<li>Kuehn Park Golf Course</li>
<li>Green Fees</li>
</ul>
</div>
<li class="dropdown">
Clubs & Leagues <b class="caret"></b>
<div class="collapse no-transition" id="menu2">
<ul class="container">
<li>Sioux Falls Men's Golf Club</li>
<li>Ladies Golf Leagues</li>
<li>Junior Golf</li>
<li>High School Golf</li>
<li>The First Tee</li>
<li>Rockafellow Scholarship</li>
</ul>
</div>
<li>Events</li>
<li>News</li>
<li>Pro Shop</li>
</ul><!-- end primary nav -->
EDIT: note that this requires bootstrap's dorpdown js and css
EDIT2: docs here