Reputation: 822
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 :
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>
Upvotes: 2
Views: 1002
Reputation: 6656
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"><a href="#">Link <span class="sr-only">(current)</span></a></li>
<li><a href="#">Link</a></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;
}
Upvotes: 2
Reputation: 99
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>
Upvotes: 3