I have a header with a logo a dropdown menu and a search bar the problem is that dropdown button it's down and I want it to up.
I have this way:
But I want something like this where button is align with the logo and search bar:
I have tried a lot of things like call the class of button in css and put margin-button with a lot of pxls but its work, any suggestion?
This is my code HTMl where I have the button:
<header>
<nav class="navbar navbar-default navbar-custom" role="navigation">
<div class="container">
<a class="navbar-left" href="#"><img src="assets/img/logo-01.png" style="max-width:70px"/></a>
<div class="navbar-header navbar-left">
<button type ="button" class="navbar-toggle" data-toggle="collapse" data-target="#collapse-1">
<span class="sr-only"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<div class="collapse navbar-collapse js-navbar-collapse">
<ul class="nav navbar-nav">
<div class="cd-dropdown-wrapper">
<button type="button" data-toggle="dropdown" class="btn btn-default dropdown-toggle cd-dropdown-trigger">Categorias</button>
<nav class="cd-dropdown">
Close
<ul class="cd-dropdown-content">
<li class="has-children">
Eletrodomésticos
<ul class="cd-secondary-dropdown is-hidden">
<li class="go-back">Menu</li>
<li class="see-all">Todos os eletrodomésticos</li>
<li class="has-children">
Eletrodomésticos
<ul class="is-hidden">
<li class="go-back">Eletrodomésticos</li>
<li class="see-all">Todos os eletrodomésticos</li>
<!--<li class="has-children">-->
<li>Grandes Eletro de cozinha</li>
....<!--(has other categories but it doesnt matter for here so I skip that part)-->
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Pesquisar Produto">
</div>
<button type="submit" class="btn btn-danger">
<i class="glyphicon glyphicon-search"></i>
</button>
</form>
</div>
</div>
</div>
</nav>
</header>
This is my css code:
.btn-default {
margin-bottom: 350px;
background: #25727D;
border-color: #25727D;
position: absolute;
margin-left: 50px;
}
.btn-default {
margin-bottom:350px;
background: #25727D;
border-color: #25727D;
position:absolute;
margin-left:50px;
}
Since .btn-default already have position:absolute, just change top:10px or top:desiredValue accordingly to change vertical position of button.
Related
I am in charge of getting the mobile navigation on the site to work as intended but I have come into a bit of a problem.
This is a link to my code, the thing is that it looks how I want it too and the functionality is kind of there what I want it to do is when it drops down that the navigation bar takes up 100% of the screen rather than activating the scroll bar.
I have already tried using the code: overflow: hidden; and overflow-y: hidden; Neither of these have worked. if the link has expired some code is provided below.
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button class="close" type="button" data-dismiss="modal">×</button>
<h4 class="modal-title">Session Timeout</h4>
</div>
<div class="modal-body">
<p>
<label>Your session has not been refreshed for 20 minutes, you will be logged out after 30 seconds. If you wish to continue working click the button below.</label>
</p>
</div>
<div class="modal-footer">
<asp:button class="btn btn-default" id="Button1" data-dismiss="modal" onclientclick="stopTimer('<%= FinalTimer.ClientID %>')" text="Continue Working" runat="server">
</asp:button></div>
</div>
</div>
</div>
<div class="navbar navbar-inverse navbar-fixed-top">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-target=".navbar-collapse" data-toggle="collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="navbar-collapse collapse">
<div id="MainMenu">
<div class="list-group panel">
<a class="list-group-item list-group-item-success" href="#demo3" data-toggle="collapse" data-parent="#MainMenu">Admin</a>
<div class="collapse" id="demo3">
<a class="list-group-item1" href="#SubMenu1" data-toggle="collapse" data-parent="#SubMenu1">Placements<i class="fa fa-caret-down"></i></a>
<div class="collapse list-group-submenu" id="SubMenu1">
<a class="list-group-item2" href="#" data-parent="#SubMenu1">New placement</a>
<a class="list-group-item2" href="#" data-parent="#SubMenu1">End Placement</a>
<a class="list-group-item2" href="#" data-parent="#SubMenu1">New Referal</a>
<a class="list-group-item2" href="#" data-parent="#SubMenu1">End Referal</a>
</div>
<a class="list-group-item1" href="#SubMenu2" data-toggle="collapse" data-parent="#SubMenu2">Appliences<i class="fa fa-caret-down"></i></a>
<div class="collapse list-group-submenu" id="SubMenu2">
<a class="list-group-item2" href="#" data-parent="#SubMenu2">Fridge</a>
<a class="list-group-item2" href="#" data-parent="#SubMenu2">Freezer</a>
</div>
<a class="list-group-item1" href="javascript:;">Backgrounds</a>
</div>
<a class="list-group-item list-group-item-success" href="#demo4" data-toggle="collapse" data-parent="#MainMenu">Item 4</a>
<div class="collapse" id="demo4">
<a class="list-group-item1" href="">Subitem 1</a>
<a class="list-group-item1" href="">Subitem 2</a>
<a class="list-group-item1" href="">Subitem 3</a>
</div>
</div>
</div>
<ul class="nav navbar-nav navbar-right">
<li>
<asp:loginview runat="server" viewstatemode="Disabled">
<anonymoustemplate>
<ul class="nav navbar-nav navbar-right">
<li>Log in</li>
</ul>
</anonymoustemplate>
<loggedintemplate>
<ul class="nav navbar-nav navbar-right">
<li>
<asp:loginstatus runat="server" onloggingout="Unnamed_LoggingOut" logoutpageurl="~/" logouttext="Log off" logoutaction="Redirect">
</asp:loginstatus></li>
</ul>
</loggedintemplate>
</asp:loginview>
</li>
</ul>
</div>
</nav>
</div>
.navbar {
position: relative;
min-height: 50px;
border: 1px solid transparent;
overflow-x:hidden;
overflow-y:hidden;
max-height:100%;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
.navbar:before,
.navbar:after {
display: table;
content: " ";
}
.navbar:after {
clear: both;
}
any advice on this would be amazing.
If you open up developer tools (F12 in Chrome/IE) and take a look at the computed tab for that element while it is expanded, you will see it has a max-height set, which is what is causing the scroll bar. To remove this, and have the max-height as the full screen, add max-height of 100vh to your CSS:
<div class="navbar-collapse collapse fullscreen-navbar-collapse">
.fullscreen-navbar-collapse {
max-height: 100vh;
}
If you only want it to this on smaller devices, wrap the CSS in a media query:
#media (max-width: 767px) {
.fullscreen-navbar-collapse {
max-height: 100vh;
}
}
I can't figure out exactly why my preNav won't drop down in mobile view. I think it might have something to do with the bootstrap.css, but I was hoping someone had some more insight on the issue. I currently have 2 'navbar navbar-fixed-top' horizontal navs on the top of my page. In mobile view, it looks like this:
and the 2nd nav (in white) drops down just fine, but clicking the top nav drop down (in black) has no reaction. Is this due to bootstrap.css? Any ideas would be helpful.Here is my CSS for each nav if it helps:
#nav1 {
position: relative;
top:0;
}
#nav2 {
position: relative;
border-bottom:none;
}
and HTML for topNav (Nav1):
<div class="container-full">
<div class="row">
<div class="navbar navbar-inverse navbar-fixed-top" id="nav1" role="navigation">
<div class="navbar-header">
<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>
</div>
<div class="col-sm-3 col-sm-3 pull-left">
<form class="navbar-form" role="search">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
<div class="input-group-btn">
<button class="btn btn-default" type="submit">GO</button>
</div>
</div>
</form>
</div>
<div class="collapse navbar-collapse navbar-collapse" id="pre-nav">
<ul class="nav navbar-nav" id="pre-nav-menu">
<li>Current Students</li>
<li>Staff</li>
<li>Employers</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<span id="phone">1.877.655.7676</span>
<input type="button" value="Request Info" class="btn btn-default pull-right" id="rinfoBtn" data-toggle="collapse" data-target=".navbar-collapse"/>
</ul>
</div>
</div>
It was indeed my data-target as vanburen pointed out. Instead of data-target=".navbar-ex1-collapse" I needed data-target=".navbar-collapse" , removing the 'ex1-' which must have been left in there as "example 1" from the original megaMenu source I pulled. Thanks vanburen!
I keep getting the same issue when attacking the problem in the method offered on various sites.
Q.How can i set the nav to a z-index of 1000 to appear above all other elements in the site?
I have tried position: absolute & relative' within the fixed div.
I need the nav to be fixed, and expand as bootstrap does but i need the whole nav at any time to appear above anything else.
The nav
<div id='nav_container' class='fixed_nav'>
<div id='nav_div' class=''>
<nav id='navbarnav' class="navbar navbar-default admin_nav_bar" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<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="#"><img class='brand_image' src='assets/images/logo-1-small.png' alt='' /></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 pills">
<li class="active home-pill"><a href="#home" id='home_button'>Home</a></li>
<li class='vids-pill'>Vids</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 pills">
<!--
<li class='login_button'>
<a href='#signin' type="button" class="btn btn-default navbar-btn nav_btn_pad" style='line-height: 0.1;'>Sign in</a>
</li>
<li class='register_button'>
<a href='#register' type="button" class="btn btn-default navbar-btn nav_btn_pad" style='line-height: 0.1;'>Register</a>
</li>
-->
<li class="dropdown">
New <b class="caret"></b>
<ul class="dropdown-menu">
<li class="divider"></li>
<li>Video</li>
<li>Picture</li>
<li>Music</li>
<li class="divider"></li>
</ul>
</li>
<li class='user_button admin-pill'>
<a href='#admin' type="button" class="btn btn-default navbar-btn nav_btn_pad" style='line-height: 0.1;'>Admin</a>
</li>
<li class='user_button myaccount-pill'>
<a href='#myaccount' type="button" class="btn btn-default navbar-btn nav_btn_pad" style='line-height: 0.1;'><? echo $_SESSION['userName']; ?></a>
</li>
<li class='logout_button'>
<a href='http://www.xxxxxxx.co/home/bin/logout/logout.php' type="button" id='logout_button' class="btn btn-default navbar-btn nav_btn_pad" style='line-height: 0.1;'>Logout</a>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
</div>
</div>
The Body of which i wish to appear below but in chrome is appearing above the nav
<div class='container'>
<h3>
New Video
</h3>
<hr />
<div id='new_vid_form' class='' style='position: relative; z-index: 0;'>
<div class="input-group marg_5">
<span class="input-group-addon">Article Title</span>
<input id='new_vid_form_title' type="text" class="form-control" placeholder="Article Title">
<span class="input-group-addon">
<span id="new_vid_form_title_status" class="glyphicon glyphicon-asterisk orange pointer status_box" title="Required field"></span>
</span>
</div>
<div class="input-group marg_5">
<span class="input-group-addon">Short Desc.</span>
<input id="new_vid_form_shortDesc_status" type="text" class="form-control" placeholder="Short Description">
<span class="input-group-addon">
<span id="new_vid_form_shortDesc_status" class="glyphicon glyphicon-asterisk orange pointer status_box" title="Required field"></span>
</span>
</div>
<hr />
<div class="input-group marg_5">
<span class="input-group-addon">Youtube ID</span>
<input id="new_vid_form_youtubeID_status" type="text" class="form-control" placeholder="Youtube Video ID | watch?v=' this bit ' ">
<span class="input-group-addon">
<span id="new_vid_form_youtubeID_status" class="glyphicon glyphicon-asterisk orange pointer status_box" title="Required field"></span>
</span>
</div>
<hr />
<textarea id="new_vid_form_longDesc" class="input-large text_area_fw" placeholder='Long Description'></textarea>
</input>
<hr />
<div class="input-group marg_5">
<span class="input-group-addon">Tags</span>
<input id="new_vid_form_tags" type="text" class="form-control" placeholder="Tags (No more than 10) seperated by comma">
<span class="input-group-addon">
<span id="new_vid_form_tags_status" class="glyphicon glyphicon-asterisk orange pointer status_box" title="Required field"></span>
</span>
</div>
<hr />
<button class='btn btn-default'>Add video</button>
</div>
</div>
The associated CSS
.fixed_nav {
width: 100%;
position: fixed;
top:0;
}
#nav_div {
z-index: 10000;
}
I use the bootstrap Navbar with headroom.js to make it move up & down. I have to set the z-index in the css for the style i used .navbar-fixed-bottom, works for top as well this way , this achives fixed & the z-index, no need to create separate styles, yours are probabaly being overridden you can check in chrome dev tools, in your bootstrap css file look for and .navbar-fixed-top, .navbar-fixed-bottom, then add z-index: 1030; I can't imagine why I used 1030, just needs to be a big enuff to be more than the total amount of elements of the page whatever yours is.
.navbar-fixed-top, .navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
}
HTML
<div class="navbar-fixed-bottom">
<ul>
<li>
...
</li>
</ul>
</div>
Possibly way off track, but in your HTML markup your navbar has the id nav_div, but your CSS selector is targeting #navdiv (no underscore)
I'm using twitter bootstrap 2.3 and when I make my browser smaller it collapses correctly but when I click on the button to do the dropdown it doesn't appear in front of the other items. Here is a working demo: http://www.thehighlightnetwork.com/ I've been trying to fix it in the developer tools in Chrome but to no avail.
Here is the relevant code:
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="brand" href="/"><img src="http://i.imgur.com/8dN9Ck1.png" alt="small logo" style="height:50px;"></a>
<div class="nav-collapse collapse" style="height:0px;">
<ul class="nav">
<li>The Highlight Network</li>
<li>Official Blog</li>
<li>Profile</li>
<li>Logout</li>
<li>Sign Up!</li>
<li>Upload</li>
</ul>
<ul class="nav pull-right">
<li>
<div class="center-it">
<form class="form-search" action="/search" method="GET" style="margin:0; margin-top:15px;">
<input type="text" name="search_tag" placeholder="search..." class="input-medium search-query pull-right">
</form>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
In the official demo site it pushes down all the other elements which I would be happy with or if I can simply make it so that it is in front of the other elements.
The static position of your fixed navbar is causing this, the following css will override that and fix your problem (confirmed in chrome)
.navbar-fixed-top, .navbar-fixed-bottom {
position: relative !important;
}
How can I remove the additional space between the nav banner and the main banner image below it?
I removed the padding and margin, but nothing is working.
My code is below.
I don't want to set positions. Can anyone tell me what the problem is?
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar collapsed" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="brand" href="#" style="padding-top: 0px;">
<img alt="change" class="defieLogo" src="http://www.defie.co/designerImages/defie_logo_only.png">
</a>
<div class="nav-collapse collapse" style="height: 0px;">
<ul class="nav">
<li class="active">Product</li>
<li>Solutions</li>
<li>Services</li>
<li class="iphonePartnerLink">Partners</li>
<li class="iphoneContactLink">Contact</li>
</ul>
<ul class="nav" id="navSecond">
<li class="">Partners</li>
<li>Contact</li>
</ul>
<form class="navbar-form pull-right">
<input class="span2" type="text" placeholder="Email">
<input class="span2" type="password" placeholder="Password">
<button type="submit" class="btn">Sign in</button>
</form>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<div class="container">
<header class="hero-unit-product">
<h1>
Defie Cloud Business Solutions
<small>.. changing the way businesses operate.</small>
</h1>
<p><a class="btn btn-green btn-large" href="/signup/" data-link="modal" data-target="#signup-modal">Register</a></p>
</header>
</div>
The space is coming from:
.home article.container {
margin-top: 30px;
}
Change it to:
.home article.container {
margin-top: 0;
}
The main problem is connected with <article class="container"> element - it has margin-top: 30px;.
You also have to change padding-top for .home selector. It's set to 55px now, but has to be 47px instead.