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;
}
Related
My main goal is to create a btn that play/pause the song on my wedding site.
I got it to work on the desktop view port, but not on the phone.
Notice the play btn on the far right, when clicking on it, it will play the song, the icon will toggle to pause, like this
So far so good, everything work perfectly fine.
Here come the issue, here what it look like on the 400px
I see it, but, they're not clickable at all.
I tried to inspect it, this is what I see.
I was thinking that I had the issue with z-index, I've tried to give one to my btn, but it still doesn't work.
I'm a little stuck now, please feel free to give me any suggestions.
HTML
<!--Header start -->
<header>
<!--menu start-->
<div class="menu">
<div class="navbar-wrapper" id="navbar">
{{-- Music --}} -------------------------------------------------
<div class="pull-right btn-music">
<a class="pause_audio_btn hidden"><i class="fa fa-pause"></i></a>
<a class="play_audio_btn"><i class="fa fa-play"></i></a>
</div>
{{-- Music --}} -------------------------------------------------
<div class="container">
<!--Logo -->
<div class="logo">
<img id="logo" src="/img/love/logo_pink.png" alt="Roth-Long-Wedding">
</div>
<div class="logo_phone hidden">
<img src="/img/love/logo_pink.png" alt="Roth-Long-Wedding">
</div>
<div class="navwrapper">
<div class="navbar navbar-inverse navbar-static-top">
<div class="container">
<div class="navArea">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav" id="navigation">
<li class="menuItem" id="home">Home</li>
<li class="menuItem">Count Down</li>
<li class="menuItem">Couple</li>
<li class="menuItem">Events</li>
<li class="menuItem">Gallery</li>
<li class="menuItem">Accommodation</li>
<li class="menuItem">RSVP</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- End Navbar -->
</div>
</div>
</div>
<!--menu end-->
<!--video header start-->
<div class="banner row" id="banner">
<div class="col-xs-12 col-sm-6 col-md-12 col-lg-12 noPadd slides-container" style="height:100%">
<!--background slide show start-->
<div class="slide into_firefly">
<!--header text1 start-->
<div class="container hedaer-inner ">
<div class=" bannerText clearfix ">
<h1>Long & Roth</h1>
<h4>WE ARE GETTING MARRIED</h4>
<p class="ruler"><span></span>
<a class="pause_audio_btn hidden"><i class="fa fa-pause"></i></a>
<a class="play_audio_btn"><i class="fa fa-play"></i></a>
<span></span></p>
<h4 class="date long">July 26th, 2016</h4>
<h4 class="date short">-07.26.2016-</h4>
</div>
<p class="downArrow"><i class="fa fa-chevron-down"></i></p>
</div>
<!--header text end-->
<img src="/img/love/main/edit/retina.jpg" alt="Main Image">
</div>
<!--background slide show end-->
</div>
</div>
<!--banner end-->
</header>
<!--Header end -->
Remove the part where you have set the logo to z-index: 9999
Then add this to your css
.navbar-header button{
float:right;
}
It is a z-index issue, but z-index is tricky and only works when the elements have a position other than static (which is default).
{{-- Music --}} -------------------------------------------------
<div class="pull-right btn-music" style="position:relative; z-index:99">
...
</div>
{{-- Music --}} -------------------------------------------------
<div class="container" style="position:relative; z-index:98">
...
</div>
(I put the styling inline for clarity)
There are likely other way to fix this, but this was the quickest.
Pull the button outside of .navbar-wrapper and put it as the first element under .menu
That'll work :)
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
I am using Bootstrap3 and using a collapsible element to in my design.
<!-- Search Filter -->
<div id="search-filter">
<div class="container">
<div class="row">
<div class="col-md-5 col-xs-12">
<!-- Collapse Search -->
<button type="button" class="navbar-toggle navbar-toggle-search-filter" data-toggle="collapse" data-target="#searchbar-collapse-set"> <span class="sr-only">Toggle navigation</span> <span class="glyphicon glyphicon-chevron-down"></span> </button>
<!-- /Collapse Search -->
<h3>Showing 345 Results <small>(Hill Stations around Bangalore)</small></h3>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="searchbar-collapse-set">
<div class="col-md-4 col-xs-12">
<div class="distance">
<h5>distance:</h5>
<div id="distance-slider"></div>
<span class="distance-value">250 kms</span>
</div>
</div>
<div class="col-md-3 col-xs-12">
<div class="sort">
<h5>sort:</h5>
<ul class="nav nav-pills">
<li class="active">popular</li>
<li>name</li>
<li>distance</li>
</ul>
</div>
</div>
</div>
<!-- /.navbar-collapse -->
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- /Search Filter -->
How can i use Media-Query or JS to keep it opened on smaller devices by default?
Add the "in" class to your searchbar-collapse-set div like so:
<div class="navbar-collapse collapse in" id="searchbar-collapse-set">
EDIT:
The toggle is controlled by a media query. It's display is set to none at 768px in this rule:
#media (min-width: 768px) {
.navbar-toggle {
display: none;
}
}
So you can either override the rule in your own styles or customize the Bootstrap css file.
I am using Bootstrap3 and using a collapsible element to in my design.
I am using 12 column inside the row as follows
<!-- Search Filter -->
<div id="search-filter">
<div class="container">
<div class="row">
<div class="col-md-5 col-xs-12">
<!-- Collapse Search -->
<button type="button" class="navbar-toggle navbar-toggle-search-filter" data-toggle="collapse" data-target="#searchbar-collapse-set"> <span class="sr-only">Toggle navigation</span> <span class="glyphicon glyphicon-chevron-down"></span> </button>
<!-- /Collapse Search -->
<h3>Showing 345 Results <small>(Hill Stations around Bangalore)</small></h3>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="searchbar-collapse-set">
<div class="col-md-4 col-xs-12">
<div class="distance">
<h5>distance:</h5>
<div id="distance-slider"></div>
<span class="distance-value">250 kms</span>
</div>
</div>
<div class="col-md-3 col-xs-12">
<div class="sort">
<h5>sort:</h5>
<ul class="nav nav-pills">
<li class="active">popular</li>
<li>name</li>
<li>distance</li>
</ul>
</div>
</div>
</div>
<!-- /.navbar-collapse -->
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- /Search Filter -->
Due to the Collapsible element i the third column is shifting to the next row.
I removed the NavCollapse padding to 0 and the content disappears from the drop down as bellow.
By Adding the following code it gets back into place as bellow.
But it Disrupts the full screen view as bellow.
Nomad Link
My suggestion is to use a media query such as
#media (min-width: 1200px) { ... }
so that you can add the padding on a desktop display without effecting the display on smaller devices.
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