Fill Remaining Width of parent - html

I have a navigation menu, with a collapsible list of child pages. Except the dropdown element needs to have an accessible page on the same line as well. This is what I have so far.
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-lg-2">
<div class="navbar navbar-default navbar-fixed-side">
<ul class="nav" id="side-menu-0">
<li id="menu-template" class="nav">
<i class="fa fa-dashboard fa-fw"></i>Dashboard
</li>
<li id="menu-template-top" class="nav" role="menu">
Google
<span class="caret"></span>
<ul id="menu-template-top-sub" class="collapse nav nav-second-level">
<li class="nav">
Flot Charts
</li>
<li class="nav">
Morris.js Charts
</li>
</ul>
<!-- /.nav-second-level -->
</li>
</ul>
</div>
</div>
Here is the working fiddle, so you can see what I am trying to do. I want the Link for "Google" to stretch across to the right, like the "Dashboard" link can do. Working Fiddle

A simple fix for this is to do this:
Google
You could of course externalize this to a stylesheet if you wish.
The 40px in the calc(100% - 40px) is the width of your dropdown caret.
This makes it stretch all the way to the dropdown-expansion button.

Add display block to your <a> tag, instead of display inline-block. Block elements will span the entire width.

Related

Fluid hoverable Drop-down menu using Bootstrap

I've been trying to make a fluid drop-down menu like the on in udemy(https://i.imgur.com/nrorrMo.png) but the options inside my drop-down doesn't appear. Is there is anything i'm doing wrong?
<ul class="nav navbar-nav">
<li class="dropdown">
Heading 1
<div class="dropdown-menu multi-column" style="width: 100%;">
<div class="row">
<div class="col-md-4">
<ul class="dropdown-menu">
<li>Opt 1</li>
<li> Opt 2</li>
</ul>
</div>
</div>
</li>
</ul>
Your error comes with the use of the class="dropdown-menu" on the UL tag inside of the div.dropdown-menu. If you remove that class, you will see the content inside the dropdown.

Div data is not getting showed

I'm new to Web Development, and i've written the following code:
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="https://in.linkedin.com/in/debdebashis" target="_blank">Debashis Deb</a>
</div>
<ul class="nav navbar-nav navbar-right">
<li>Home
</li>
<li>About Me
</li>
<li>Skills
</li>
<li>Interests
</li>
<li>Contact Me
</li>
<li>
<a> </a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid first">
<p>Welcome to my Page, Here you can find most of the informations related to me</p>
</div>
The problem that I'm facing is that, my last div is not getting displayed in the page. What mistake am I doing ?
On a fixed navbar you have to add a padding to the <body> of your site:
From the Bootstrap Documentation:
The fixed navbar will overlay your other content, unless you add padding to the top of the . Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high.
Make sure to include this after the core Bootstrap CSS.
http://getbootstrap.com/components/#callout-navbar-fixed-top-padding
body {
padding-top: 70px;
}
See the following snippet (little changes to support the responsive navbar too): https://jsfiddle.net/17mmmxps/1/

Dropdown menu position is wrong and couldn't make the maps full height

I'm creating the following web app: https://mobigas.herokuapp.com/ and I'm having some problems with its css.
When you place your mouse over the "ENTRAR" link it displays the Sign In form in a wrong position (its left margin should be aligned to the left margin of the link).
And also, I tried to make the DIV with the map use the rest of the available visible area, but with no luck.
Here is the HTML of the menu and the CSS, however, I think looking at the Heroku link will be more helpful.
<div class="header-nav-main header-nav-main-light header-nav-main-effect-1 header-nav-main-sub-effect-1 collapse">
<nav>
<ul class="nav nav-pills" id="mainNav">
<li class="dropdown dropdown-mega dropdown-mega-signin signin" id="headerAccount">
<a class="dropdown-toggle" href="page-login.html">
<i class="fa fa-user"></i> ENTRAR
<i class="fa fa-caret-down"></i><i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu">
<li>
<div class="dropdown-mega-content">
<div class="row">
<div class="col-md-12"> <!--content-->
</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
</nav>
</div>
The map div is inside the <div class="body"> below the <header> element.
<div role="main" class="main">
<!-- Google Maps -->
<div id="googlemaps" class="google-map full-height mt-none mb-sm"></div>
</div>
This is a customization of the Porto template I've bought on ThemeForest and it uses Bootstrap 3.
UPDATE
Currently the <li class="dropdown dropdown-mega dropdown-mega-signin signin"> element and the <ul class="dropdown-menu"> are using position: static, and changing the dropdown-menu as another user suggested made the dropdown-menu smaller.
I've increase the width of the dropdown-menu and fixed the width of the <a class="dropdown-toggle">, but this made the Google Maps div to go down.
Well first to the sign in Form:
You can achieve the postitioning by giving .dropdown-menu a relative position
.dropdown-menu{
position: relative;
top: 0px;
left: 0px;
}
This way the position is calculated relative to the link.

Increasing the height of the Bootstrap Collapsed "mobile" navigation menu?

I am struggling to get the mobile collapsed drop down nav to increase in height. Currently it is stuck at about 340px and I need it to expand to fit the menu items being contained within the collapsed nav. I have searched tirelessly on Google and here to find an answer but none of them seem to make an impact, even when I use !important.
Here's a screenshot of what I am talking about to avoid any confusion. The blue bordered area that I added to the screenshot is what I am talking about. This seems to be set to a static height and I need it to extend about another 50px-100px for this particular application. I did not show code here because I am hoping to just see the "best way" to change the default height for my future reference.
Thanks for the help!
EDIT: I did not submit code because right now it's just the default bootstrap nav code so I didn't think I needed to reference it.
Here's the code, I am just using a simple generic startbootstrap.com template here.
<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<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 page-scroll" href="#page-top">Start Bootstrap</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden">
<a class="page-scroll" href="#page-top"></a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
<li>
<a class="page-scroll" href="#about">About</a>
</li>
<li>
<a class="page-scroll" href="#services">Services</a>
</li>
<li>
<a class="page-scroll" href="#contact">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
I have no custom CSS yet as this is the first thing I am trying to change and don't know where in the CSS the dropdown nav should be edited.
Without seeing the code it is difficult to say what is impacting the height. If you add more <li>'s to the menu, does it expand?
If not, there could be a static height or max-height css property applied to the .dropdown-menu
Editing for improvement:
It looks like either of these elements;
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
has a height or max-height and overflow:auto property.
Inspect these elements in chrome to see if this is the case. Then, set height:auto; and/or adjust the max-height property to allow for increased height for that element.
You can set these in your custom CSS file and they will override Bootstrap's style. Just ensure that your CSS file is loaded after the Bootstrap CSS file.
If you can post a link I can look at it and provide the exact code needed to make the changes.
I had the same problem with my mobile collapsed drop-down navigation displaying a scrollbar rather than expanding to show all the navigation links. My solution was to hide the scrollbar then add pixels to the bottom of my data-target div.
You should be able to hide the scrollbar using:
.navbar-collapse.in {
overflow: hidden;
}
Then you can add the extra pixels needed at the bottom by adding padding to the data-target div when sized for mobile devices:
#media (max-width: 768px) {
.navbar-ex1-collapse {
padding-bottom: 50px;
}
}

How to: Non collapsing navigation items Bootstrap 3

I have searched high and low for this, on SO too but didn't find the "correct" answer.
Just figured it out myself.. Thought to share this, hope it helps someone..
Problem with BS3 is that it's Mobile first, which is a good thing, usually.. It's just that I need a few "default" options in the navbar regardless of the collapse state. Just like BS2.
So how can we do this?
One thing is obvious looking at the html code, the .navbar-header stays where it is, it doesn't collapse. Another thing, the magic collapse button has some way of hiding itself, probably CSS but hey, the idea is to abstract this layer so we don't have to worry about it..
But we can take advantage of this, let's place the links I want to show in there, they won't collapse.
What you will see is that your list items will end up vertically, that's not what you want.. So why does it do that?
Well.. If you use Firebug or some other development inspector, you will find that these items have been set to display : block;, that is making them the width of the screen pushing each next item down.
We need to change that behaviour. So let's add a new class to the ul that we can define in our custom CSS. I named it no-collapse but you can name it whatever you want..
<nav role="navigation" class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" data-toggle="collapse" data-target="#bs-navbar-collapse" class="navbar-toggle">
<span class="sr-only">Hamburger menu</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- THIS IS WHERE THE MAGIC HAPPENS! -->
<ul class="nav navbar-nav no-collapse">
<li>Apple
</li>
<li>Banana
</li>
</ul>
</div>
<!-- THE STUFF IN THIS DIV WILL COLLAPSE.. -->
<div id="bs-navbar-collapse" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="dropdown">More Fruits <b class="caret"></b>
<ul class="dropdown-menu">
<li class="dropdown-header">Citrus</li>
<li>
Lemon
</li>
<li>
Orange
</li>
<li class="divider"></li>
<li class="dropdown-header">
Also a fruit
</li>
<li>
Tomato
</li>
</ul>
</li>
<li class="dropdown">Veggies <b class="caret"></b>
<ul class="dropdown-menu">
<li class="dropdown-header">Green stuff</li>
<li>
Spinache
</li>
<li>
Lettuce
</li>
<li class="divider"></li>
<li class="dropdown-header">Other stuff</li>
<li>Carrot
</li>
<li>Romenesko broccoli
</li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
This works
</li>
</ul>
</div>
</div>
</nav>
You'll need a modification, add a CSS (or LESS/SASS) after the bootstrap style sheets.
Add this CSS:
.no-collapse li, .no-collapse li a
{
text-align : center;
float : none;
display : inline-block;
}
Now in Bootply it would look like this: http://www.bootply.com/render/133885 source here:http://www.bootply.com/133885
Now we can have the healthy Apple and Banana on the screen on our mobile devices without resorting to the hamburger menu!