I have a master page that has a header bar in the page that is using the bootstrap.
Here is the code
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<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 id="navbar" class="navbar-collapse collapse">
<div class="left">
<asp:ImageButton ID="btn_home" runat="server" ImageUrl="../Images/HeadHome.png" CssClass="headIcons" />
</div>
<div class="left">
<asp:ImageButton ID="btn_config" runat="server" ImageUrl="~/Images/HeadConfig.png" CssClass="headIcons" />
</div>
<div class="right">
<asp:ImageButton ID="btn_profile" runat="server" ImageUrl="~/Images/HeadProfile.png" CssClass="headIcons" />
</div>
</div>
<!--/.navbar-collapse -->
</div>
</nav>
Here is my Webform ASPX code
<div class="row">
<div class="col-md-12"">
<div class="b-orange" style="background-color: #f29123; height: 5px;"></div>
</div>
</div>
<div class="row">
<div class="col-md-12" style="top: 60px;">
<img src="../Images/bSimplex_Header_Logo.jpg" style="margin: 0 auto; display: block;" />
</div>
</div>
The problem is that the page adds the header but doesn't recognise the height so when i add things into the page it goes from the top and not from the header
Some images:
As you can the first row in my ASPX page is starting from the very top and not from the navbar in the master page.
That is because navbar-fixed-top makes the navbar sticky by position: fixed;.
To have page content always be below the navbar, add body padding:
body { padding-top: 50px; }
Or even better using less:
body { padding-top: #navbar-height; }
See Bootstrap documentation on fixed-to-top navbar
Related
I want to align the button to right side.
<div class="navbar-header">
Logo
<button type="button" class="navbar-toggler" (click)="collapsed=!collapsed">
<span class="navbar-toggler-icon"></span>
</button>
</div>
Current alignment of menu bar
I have already tried using float on button but its not working.
Give display: flex; width: 100%; to the parent and put this tag after your a tag:
<div style="flex-grow: 1"></div>
Should be like this:
<div class="navbar-header" style="display: flex; width: 100%;">
Logo
<div style="flex-grow: 1"></div>
<button type="button" class="navbar-toggler" (click)="collapsed=!collapsed">
<span class="navbar-toggler-icon"></span>
</button>
</div>
I have written this markup:
<nav class="navbar navbar-expand-lg">
<a class="navbar-brand overflow-hidden pr-3" href="#Url.Action("Index","Home")">
<!--<img src="~/Content/Theme/images/logo-dark.png" alt="" />-->
<img src="~/Content/Theme/images/Velosi/applusLogo.jpg" style="height:50px" alt="" />
</a>
<div class="d-sm-none">
<h3>THIS SHOULD BE ONLY DISPLAYED ON MOBILE PHONES</h3>
</div>
<button class="navbar-toggler" type="button" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<div class="hamburger hamburger--emphatic">
<div class="hamburger-box">
<div class="hamburger-inner"></div>
</div>
</div>
</button>
I expect the
<div class="d-sm-none">
<h3>THIS SHOULD BE ONLY DISPLAYED ON MOBILE PHONES</h3>
</div>
to be only displayed on cell phones and not beyond, but it is displayed on every screen size. Why is that?
try this:
<div class="d-none d-sm-none d-md-block">
I'm trying to create a login page for my application .It includes a header ,login form which is horizontally and vertically centered and a footer .Everything works fine in the normal mode but when i load it in mobile landscape mode footer overlaps the login form .Can anyone help me how to figure it out .I know the issue is due to fixed footer a the bottom but when i try to give position:absolute or position:relative the footer jumps near the header
.full-width{width:100%;}
.login-container{position: absolute;transform: translate(-50%, -50%);width: 330px;margin:auto;padding-bottom:100px;}
.parent {position:fixed;top: 50%;left: 50%;transform: translateY(-50%);margin-top:60px}
<nav class="navbar navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed bottom-line" 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 logoLinkStyle" href="#">
<img [src]="'application/images/logo.png'" alt="Brand logo">
</a>
</div>
</div>
<!-- /.container-fluid -->
</nav>
<div class="parent">
<div class="row login-container">
<div class="col-lg-12">
<form name="form" #loginForm="ngForm" novalidate>
<h1 class="welcomeheading">WELCOME</h1>
<div class="form-group">
<input class="form-control user" name="username" placeholder="Username" aria-label="Username" required autofocus>
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" type="password" name="password" aria-label="Password" required>
</div>
<button class="btn full-width" [disabled]="loading">Login</button>
<div class="login-forgot">
Forgot your password?
</div>
</form>
</div>
</div>
</div>
<div class="container-fluid" style="position: fixed;bottom: 0;width: 100%;">
<div class="row">
<div class="col-lg-10 col-sm-12">
<h6>Copyright (c) 2017 this is the copyright of application developed
</h6>
</div>
<div class="col-lg-2 col-sm-12">
<img [src]="FooterLogo" alt="Footer logo" />
</div>
</div>
</div>
You could add a media query and remove the absolute positioning on mobile.
You'd have to calculate your height breakpoint, but it would look something like this:
#media screen and (max-height: 400px) {
.parent, .login-container {
position: static;
transform: none;
}
.footer {
position: relative;
}
}
Without using HTML Table is there any solution to put 2 divs on different columns in a row and on the same rows, 2 divs on the same column one above another one?
This is an image that explains better:
I'm using bootstrap, i'm trying to reach this :
This is what i get now:
How can i align bottom-top DIV 1 and DIV 2 to be centered if there are on different rows?
At this moment my html grid is like :
.label {
font-size: 15px;
}
` #liveChat {
background-color: #1C3A69;
}
`
<div class="container">
<div class="col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-12 col-xs-12 panel" id="mainDiv">
<header class="row panel-heading"> <span>Tax</span>Extension.com</header>
<div id="liveChat" class="row ">
<div class="container">
<div class="row">
<div id="taxExtensions" class="label col-md-2 leftItems">
My Tax Extensions
</div>
<div id="UpdateAccount" class="label col-md-1 leftItems ">
Update Account Info
</div>
<div class="label col-md-2 col-md-offset-7 ">
<div>
LIVE CHAT
</div>
<div>
Support is Online
</div>
</div>
</div>
</div>
</div>
<div class="panel-body row" id="mainContent" style="min-height:200px; background-color:aquamarine;">
</div>
<footer class="panel-footer row">Footer</footer>
</div>
</div>
A simple one can be made like this, if the navbar has predefined height
Basically it's just a stack of divs
#div-l{
background-color:red;
}
#div-m{
background-color:blue;
}
#div-r1{
background-color:green;
}
#div-r2{
background-color:grey;
}
.single-stack{
height:50px;
float:left;
width:33%
}
.double-stack{
height:25px;
float:left;
width:33%
}
<div id="div-l" class="single-stack"> </div>
<div id="div-m" class="single-stack"> </div>
<div id="div-r1" class="double-stack"> </div>
<div id="div-r2" class="double-stack"> </div>
If you're working for a navbar. Then why not use bootstrap navbar component?
Check this out. You can also see it here
HTML
<nav class="navbar navbar-default sample">
<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" 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>
<!-- 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">Link <span class="sr-only">(current)</span></li>
<li>Link</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<div class="row right-items text-center">
<div class="col-xs-12">LIVE CHAT</div>
<div class="col-xs-12">Support is Online</div>
</div>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
CSS:
.sample{
background: #1c3a69;
}
nav{
color: #fff;
}
.right-items {
margin-top: 5px;
}
I am using Bootstrap + Bootstro but can't make the top navbar to get behind the overlay.
http://jsfiddle.net/NJsYw/5/ (click on Tutorial)
<div id="wrap">
<!-- Fixed navbar -->
<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="#">Project name</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li><a href="#" id='tutorial'>Tutorial</a></li>
</ul>
</li>
</ul>
</div><!--/.nav-collapse -->
</div>
</div>
</div>
<!-- Begin page content -->
<div class="container">
<div class="page-header">
</div>
<p class="lead bootstro" data-bootstro-title='Title' data-bootstro-content="Description." data-bootstro-width="400px" data-bootstro-placement='bottom' data-bootstro-step='0'>Pin a fixed-height footer to the bottom of the viewport in desktop browsers with this custom HTML and CSS. A fixed navbar has been added within <code>#wrap</code> with <code>padding-top: 60px;</code> on the <code>.container</code>.</p>
<p class="bootstro" data-bootstro-title='Title' data-bootstro-content="Description." data-bootstro-width="400px" data-bootstro-placement='bottom' data-bootstro-step='1'>Back to the sticky footer minus the navbar.</p>
</div>
<div id="push"></div>
</div>
<div id="footer">
<div class="container">
<p class="muted credit">Example courtesy Martin Bean and Ryan Fait.</p>
</div>
</div>
Looks like this was address here https://github.com/clu3/bootstro.js/issues/15 but I didn't know how to apply (if it is necessary)
Thanks
This can be done using CSS the key is z-index which specifies the stack order of an element.
The bootstrap navbar has a z-index of 1030 so in order for the bootstro backdrop to cover the navbar you need to adjust the z-index to be higher than 1030.
e.g.
.bootstro-backdrop
{
....
z-index: 2000;
}
You also need to make sure that the bootstrap popover is not covered so you need to increase its z-index to be higher than 2000.
.popover {
z-index:2001;
}
FIDDLE