Div centering within another Div - left aligned? - css

I know this question has been asked several time before, and generally I can fix it myself, but for some reason I can not get these icons to center. They are always left aligned. If the good people of SO wouldn't mind taking a look I would be much obliged. It is probably an easy fix, I'm just overlooking something.
HTML:
<div class="footerSection">
<div class="col-lg-4 col-md-4 col-sm-4 btn-toolbar">
<span id="" class="btn btn-lg footerMainButton"></span>
</div>
<div id="footerInside" class="col-lg-4 col-md-4 col-sm-4">
<div class="divOuter col-lg-12">
<div class="col-lg-2 col-md-2 col-sm-2 divCenter">
<button type="button" class="footerSave">
<img class="footerSvg" src="../../img/icon_disk_save.svg" alt="save" /><br /><span>Save</span>
</button>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 divCenter">
<button type="button" class="footerPreview">
<img class="footerSvg" src="../../img/icon_play.svg" alt="preview" /><span><br />Preview</span>
</button>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 divCenter">
<button type="button" class="footerDelete">
<img class="footerSvg" src="../../img/icon_trash.svg" alt="delete" /><br /><span>Delete</span>
</button>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 divCenter">
<button type="button" class="footerView">
<img class="footerSvg" src="../../img/icon_long_right_arrow.svg" alt="view" /><span><br />View/Edit</span>
</button>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 divCenter">
<button type="button" class="footerRemove">
<img class="footerSvg" src="../../img/icon_minus.svg" alt="remove" /><span><br />Remove</span>
</button>
</div>
<div class="col-lg-2 col-md-2 col-sm-2 divCenter">
<button type="button" class="footerNewMedia">
<img class="footerSvg" src="../../img/icon_upload_arrow.svg" alt="New Media" /><span><br />New Media</span>
</button>
</div>
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4">
<button type="button" class="mapMarkerStyle">
<img style="width: 36px;height: 36px;" src="../../img/icon_map_pin_blue.svg" alt="Map Pin" /><span></span>
</button>
</div>
</div>
CSS:
.footerSection {
width: 100%;
height: 100px;
background-color: #424242;
display: block;
position: fixed;
z-index: 999;
padding: 20px 0 20px;
bottom: 0;
}
#footerInside {
display: block;
float: left
}
.divOuter {
margin: 0 auto;
}
.divCenter {
text-align: center;
}
Some notes on the code. The centered icons are display none normally until called. Using display: none as to not take up space.

Make these changes to your CSS:
#footerInside {
width: 500px;
margin: 0 auto;
}
#footerInside div {
display: block;
float: left;
}
FIDDLE: http://jsfiddle.net/dzort1rb/

Your code is working fine for me
Use class="text-center" in the parent div where you required

Related

My Last Element in the div Overflows so Only Half of the Element is Visible

I'm preparing my site for mobile browsers, so on Chrome Dev Tools i've tested on 320 x 568 size and i've encountered this problem.
My button element is on the bottom of the div, but half of the button is visible, other half is not.
Screenshot on the situation
I've tried to style the background (background-size etc) but the changes did not solve the issue.
What's the basic documentation / suggestion to overcome this problem?
Parent Div
<div class="view" id="activeSubstance" data-spy="activeSubstance" data-target="#activeSubstance" style="background-image: url('img/calculate_02.jpg'); background-repeat: no-repeat; background-size: cover; background-position: center center;"></div>
The Child
<div class="row text-center align-items-center mt-3">
<div class="col" id="calculate">
<button type="button" class="btn btn-cyan btn-lg disabled" id="calcButton">Hesaplayalım</button>
</div>
</div>
Full Code
<div class="view" id="activeSubstance" data-spy="activeSubstance" data-target="#activeSubstance" style="background-image: url('img/calculate_02.jpg'); background-repeat: no-repeat; background-size: cover; background-position: center center;">
<!-- Mask & flexbox options-->
<div class="mask rgba-stylish-light align-items-center flex-center">
<!-- Content -->
<div class="container">
<div class="row mt-3">
<!--Dropdown primary-->
<div class="col mt-2">
<!--Dropdown primary-->
<div class="dropdown">
<!--Trigger-->
<a class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" style="display: block">Etken Madde Seçimi</a>
<!--Menu-->
<div class="dropdown-menu dropdown-primary" id="substanceList">
<a class="dropdown-item">Daptomisin - <small>Cubicin</small></a>
<a class="dropdown-item">Ertapenem sodyum - <small>İnvanz</small></a>
<a class="dropdown-item">Flukonazol - <small>Lumen EF</small></a>
<a class="dropdown-item">İmipenem / Silastatin sodyum - <small>Tienam</small></a>
<a class="dropdown-item">Kolistimetat sodyum - <small>Colimycin</small></a>
<a class="dropdown-item">Levofloksasin - <small>Tavanic</small></a>
<a class="dropdown-item">Linezolit - <small>Zyvoxid</small></a>
<a class="dropdown-item">Meropenem trihidrat - <small>Meronem</small></a>
<a class="dropdown-item">Metronidazol - <small>Metronidazol</small></a>
<a class="dropdown-item">Moksifloksasin hidroklorür - <small>Avelox</small></a>
<a class="dropdown-item">Piperasilin sodyum / Tazobaktam sodyum - <small>Tazocin EF</small></a>
<a class="dropdown-item">Sefoperazon sodyum / Sulbaktam sodyum - <small>Sulperazon</small></a>
<a class="dropdown-item">Siprofloksasin laktat - <small>Ciproktan</small></a>
<a class="dropdown-item">Teikoplanin - <small>Targocid</small></a>
<a class="dropdown-item">Tigesiklin - <small>Tygacil</small></a>
<a class="dropdown-item">Vankomisin hidroklorür - <small>Vancotek</small></a>
</div>
</div>
</div>
<!--/Dropdown primary-->
<!--Dropdown primary-->
<div class="col mt-2">
<!--Dropdown primary-->
<div class="dropdown">
<!--Trigger-->
<a class="btn btn-primary dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false" style="display: block">Cockcroft-Gault Denklemi</a>
<!--Menu-->
<div class="dropdown-menu dropdown-info" id="methodlist">
<a class="dropdown-item2" id="willDisable">Cockcroft-Gault Denklemi</a>
<a class="dropdown-item2" id="willDisable2">e-GFR Hesaplayıcısı</a>
</div>
</div>
</div>
<!--/Dropdown primary-->
</div>
<div class="row mt-3">
<div class="col" style="display:none" id="notNeeded">
<p class="note note-info wow fadeIn" id="nonDiyaText">Bu etken madde için böbrek yetmezliği durumunda doz ayarlaması gerekmemektedir.</p>
</div>
</div>
<div class="row text-center align-items-center" id="cockgaulty">
<div class="col-6 col-lg-2">
<select class="browser-default custom-select" id="gender1">
<option selected>Cinsiyet</option>
<option value="1">Erkek</option>
<option value="2">Kadın</option>
</select>
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="age1" class="form-control" placeholder="Yaş" aria-label="Yaş" aria-describedby="material-addon1" step='1' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="srcr1" class="form-control" placeholder="Serum kreatinini" aria-label="Serum kreatinini" aria-describedby="material-addon1" step='0.01' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2">
<select class="browser-default custom-select" id="crunit1">
<option selected value="1">mg/dL</option>
<option value="2">‎µmol/L</option>
</select>
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="weight" class="form-control" placeholder="Ağırlık" aria-label="Ağırlık" aria-describedby="material-addon1" step='0.5' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2 custom-control custom-checkbox mt-3" id="diya1" style="padding-left: 2.5rem;">
<input type="checkbox" class="custom-control-input" id="diyaliz1">
<label class="custom-control-label" id="dia1" for="diyaliz1">Hemodiyaliz Alıyor</label>
</div>
</div>
<div class="row text-center align-items-center" style="display:none" id="egfry">
<div class="col-6 col-lg-2">
<select class="browser-default custom-select" id="gender2">
<option selected>Cinsiyet</option>
<option value="1">Erkek</option>
<option value="2">Kadın</option>
</select>
</div>
<div class="col-6 col-lg-1 md-form input-group mb-3">
<input type="number" id="age2" class="form-control" placeholder="Yaş" aria-label="Yaş" aria-describedby="material-addon1" step='1' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="srcr2" class="form-control" placeholder="Serum kreatinini" aria-label="Serum kreatinini" aria-describedby="material-addon1" step='0.01' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-1">
<select class="browser-default custom-select" id="crunit2">
<option selected value="1">mg/dL</option>
<option value="2">‎µmol/L</option>
</select>
</div>
<div class="col-6 col-lg-1 md-form input-group mb-3">
<input type="number" id="nitrog" class="form-control" placeholder="BUN" aria-label="BUN" aria-describedby="material-addon1" step='0.01' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-2 md-form input-group mb-3">
<input type="number" id="albumin" class="form-control" placeholder="Albumin" aria-label="Albumin" aria-describedby="material-addon1" step='0.01' autocomplete="off" min="0">
</div>
<div class="col-6 col-lg-1 custom-control custom-checkbox mt-2">
<input type="checkbox" class="custom-control-input" id="black">
<label class="custom-control-label" for="black">Siyahi</label>
</div>
<div class="col-6 col-lg-2 custom-control custom-checkbox mt-2" id="diya2">
<input type="checkbox" class="custom-control-input" id="diyaliz2">
<label class="custom-control-label" id="dia2" for="diyaliz2">Hemodiyaliz Alıyor</label>
</div>
</div>
<div class="row mt-3">
<div class="col" id="infoDiv">
<p class="note note-info wow fadeIn" id="infoText"><strong>Cockcroft-Gault Denklemi </strong>ile hesaplama yaparken cinsiyet, yaş, ağırlık ve serum kreatinini değerlerini girmeniz gerekir.</p>
</div>
</div>
<div class="row text-center align-items-center mt-3">
<div class="col" id="calculate">
<button type="button" class="btn btn-cyan btn-lg disabled" id="calcButton">Hesaplayalım</button>
</div>
</div>
<!-- /Content -->
</div>
</div>
Problem Causing "view" class CSS
.view {
position: relative;
overflow: hidden;
cursor: default; }
.view .mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
overflow: hidden;
width: 100%;
height: 100%;
background-attachment: fixed; }
.view img, .view video {
position: relative;
display: block; }
.view video.video-intro {
z-index: -100;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
-webkit-transition: 1s opacity;
-o-transition: 1s opacity;
transition: 1s opacity;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto; }
PS: As you can see in the screenshot, "The end of the div" i've mentioned is not the end of the page, instead another DIV starts. But my button overflowed from the div above and only half of it is visible
close the div class="view" may be your problem resolved

Add button inside an Input Tag

I have created a login form. I want to show a text/button that says "FORGOT?" on the right side of the password field.
For reference you guys can open this site and click on login : https://www.adda247.com/
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<form>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<button class="form-control btn btn-info " style="background:#4568B2;height:40px">
<i class="fa fa-facebook"></i> Continue with Facebook
</button>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<button class="form-control btn btn-default" style="height:40px;border:2px solid black">
<i class="fa fa-google"></i> Continue with Google
</button>
</div>
<br><br><br>
<div class="col-md-5 col-sm-5 col-xs-5" ></div>
<div class="col-md-2 col-sm-2 col-xs-2" align="center"><b>OR</b></div>
<div class="col-md-5 col-sm-5 col-xs-5"></div><br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<input type="text" name="name" class="form-control" style="height:40px;" placeholder="Email">
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<input type="text" name="pass" class="form-control" style="height:40px;" placeholder="Password">
<p class="form-control-feedback">Forgot?</p>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<button name="login" class="btn btn-warning form-control" style="height:40px;font-size:20px">Login</button>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<p align="center" style="font-size:16px">Don't Have an Account?
<span >SIgn Up</span>
</p>
</div>
</div>
</form>
Hope you can help me !
If I understood the question correct this is the solution?
You just have to manipulate the display arguments in your css
<div class="container">
<div class="col-md-12 col-sm-12 col-xs-12">
<button class="form-control btn btn-default" style="height:40px;border:2px solid black">
<i class="fa fa-google"></i> Continue with Google
</button>
</div>
<br><br><br>
<div class="col-md-5 col-sm-5 col-xs-5" ></div>
<div class="col-md-2 col-sm-2 col-xs-2"><b>OR</b></div>
<div class="col-md-5 col-sm-5 col-xs-5"></div><br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<input type="text" name="name" class="form-control" style="height:40px;" placeholder="Email">
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<input type="text" name="pass" class="form-control" style="height:40px; width: 90%; display: inline-block" placeholder="Password">
<a class="form-control-feedback" style="display:inline-block; width:5%" href="#">Forgot?</a>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<button name="login" class="btn btn-warning form-control" style="height:40px;font-size:20px">Login</button>
</div>
<br><br><br>
<div class="col-md-12 col-sm-12 col-xs-12">
<p style="font-size:16px">Don't Have an Account?
<span >SIgn Up</span>
</p>
</div>
</div>
Add padding on password field padding-right: 80px
Set the password field container to position: relative then set "FORGOT?" hint to position: absolute and right: 1em (so that it's fixed to its righ) then design it as you want using CSS or bootstrap classes (you'll still need a bit of pure CSS, I used the same padding and height as the input in this example).
To avoid overlapping issues, I set a white background on the "FORGOT?" hint so any overlapping text is not shown (you could add it through the bg-white class as well) but you could set a padding-right on your <input> that equals the width of the "FORGOT?" hint.
.form-group.has-feedback {
position: relative;
}
.form-control-feedback {
position: absolute;
display: inline-block;
top: 1px;
right: 1em;
background: #fff;
bottom: 0;
margin: 0;
height: calc(1.5em + .75rem + 2px);
padding: .375rem .75rem;
border-radius: 3px;
}
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<form>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<button class="form-control btn btn-info " style="background:#4568B2;height:40px">
<i class="fa fa-facebook"></i> Continue with Facebook
</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<button class="form-control btn btn-default" style="height:40px;border:2px solid black">
<i class="fa fa-google"></i> Continue with Google
</button>
</div>
<div class="col-md-5 col-sm-5 col-xs-5 mb-4" ></div>
<div class="col-md-2 col-sm-2 col-xs-2 mb-4" align="center"><b>OR</b></div>
<div class="col-md-5 col-sm-5 col-xs-5 mb-4"></div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<input type="text" name="name" class="form-control" style="height:40px;" placeholder="Email">
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback mb-4">
<input type="text" name="pass" class="form-control" style="height:40px;" placeholder="Password">
<p class="form-control-feedback">FORGOT?</p>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<button name="login" class="btn btn-warning form-control" style="height:40px;font-size:20px">Login</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-4">
<p align="center" style="font-size:16px">Don't Have an Account?
<span >SIgn Up</span>
</p>
</div>
</div>
</form>
I suggest you to not use <br> elements to create spaces between your items, bootstrap has classes for that (such has .mb-4 for example).
I have used the position relative and absolute method to move the button inside the input box.
Remove br and use mt- and mb- values to get spacing in bootstrap 4.
.form-group.has-feedback {
position: relative;
}
.form-control-feedback {
position: absolute;
top: 0;
right: 15px;
padding: 6px 8px 9px 8px;
display: inline-block;
}
.form-group.has-feedback .form-control {
padding: 0 70px 0 0;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<form>
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 mb-3">
<button class="form-control btn btn-info " style="background:#4568B2;height:40px">
<i class="fa fa-facebook"></i> Continue with Facebook
</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-3">
<button class="form-control btn btn-default" style="height:40px;border:2px solid black">
<i class="fa fa-google"></i> Continue with Google
</button>
</div>
<div class="col-md-5 col-sm-5 col-xs-5"></div>
<div class="col-md-2 col-sm-2 col-xs-2" align="center"><b>OR</b></div>
<div class="col-md-5 col-sm-5 col-xs-5"></div>
<div class="col-md-12 col-sm-12 col-xs-12 my-3">
<input type="text" name="name" class="form-control" style="height:40px;" placeholder="Email">
</div>
<div class="col-md-12 col-sm-12 col-xs-12 form-group has-feedback">
<input type="text" name="pass" class="form-control" style="height:40px;" placeholder="Password">
<p class="form-control-feedback">Forgot?</p>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 mb-3">
<button name="login" class="btn btn-warning form-control" style="height:40px;font-size:20px">Login</button>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<p align="center" style="font-size:16px">Don't Have an Account?
<span>SIgn Up</span>
</p>
</div>
</div>
</form>

Z-index not working on div on fixed position header

I have a page using a masterpage in asp.net 4.0. My masterpage has header which has a search box. Header has css position fixed and have z-index 10.
I am trying to create a search instruction which will open when user types anything. my instruction box do not show as floatig over header instead it opens inside header and expands it. Here are my css and html
header {
width:100%;
display:inline-block;
background-color:#ef4023;
position:fixed;
z-index:10;
}
header #Guide {
width: 100%;
z-index: 5;
margin-right: -1px;
position:relative;
background: #eee;
border: 1px solid #ccc;
}
<header>
<div class="col-lg-4 col-md-4 col-sm-2 col-xs-4">
<div class="logo">
<img src="images/logo.png" alt="logo" class="img-responsive" />
</div>
</div>
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-8">
<div class="col-md-6">
<!--SearchBarStart-->
<div ng-controller="MyCtrl">
<form>
<h3>Search Here </h3>
<input type="text" class="form-control" id="SearchKeyword" ng-model="searchText" required="required" />
<div class="list-group" id="Guide" ng-show="showLinks">
<a class="list-group-item" href="" ng-click="SearchType(0,true,'KeyWord', 1)">
<div class="input-group">
<span class="fa fa-suitcase"></span><span style="padding-left: 20px">instruction goes here</span>
</div>
</a>
</div>
</form>
</div>
</div>
</div>
</header>
You have to use position: fixed also on the instruction box, with according position settings. (relative will put it into the document flow, thereby taking up space, and absolute won't work since you don't have a relative parent for it.)
header {
width: 100%;
display: inline-block;
background-color: #ef4023;
position: fixed;
z-index: 10;
}
header #Guide {
width: 100%;
z-index: 15;
margin-right: -1px;
position: fixed;
top: 110px;
left: 0px;
background: #eee;
border: 1px solid #ccc;
}
<header>
<div class="col-lg-4 col-md-4 col-sm-2 col-xs-4">
<div class="logo">
<img src="images/logo.png" alt="logo" class="img-responsive" />
</div>
</div>
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-8">
<div class="col-md-6">
<!--SearchBarStart-->
<div ng-controller="MyCtrl">
<form>
<h3>Search Here </h3>
<input type="text" class="form-control" id="SearchKeyword" ng-model="searchText" required="required" />
<div class="list-group" id="Guide" ng-show="showLinks">
<a class="list-group-item" href="" ng-click="SearchType(0,true,'KeyWord', 1)">
<div class="input-group">
<span class="fa fa-suitcase"></span><span style="padding-left: 20px">instruction goes here</span>
</div>
</a>
</div>
</form>
</div>
</div>
</div>
</header>`

how do you adjust bootstrap form and button to be the same height inside a div?

I have the below HTML and CSS - how do I make the search-bar and add-contacts the same height? I currently have their height set to 100% in CSS to expand inside their container div but that doesn't work Is it possible to change their height even though they are bootstrap units?
HTML
<div className="container">
<form className="form-inline search-bar" role="form">
<div className="form-group has-success has-feedback">
<label className="control-label" htmlFor="inputSuccess4"></label>
<input type="text" className="form-control" id="inputSuccess4" type="text" placeholder="Search" onChange={handleChange}/>
<span className="glyphicon glyphicon-search flipped form-control-feedback"></span>
</div>
</form>
<div className="add-contacts">
<button type="button" className="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
+ Contacts Keeper
</button>
</div>
</div>
CSS
.table-container {
margin: 20px;
}
.search-bar {
margin-left: 20px;
float: left;
height: 100%;
}
.add-contacts {
margin-right: 20px;
float: right;
height: 100%;
}
Just change the height of the search bar.
Or you could put search bar in same div as add contacts bar.
I find simpler is better with Bootstrap. I try to avoid adding custom CSS for most of the HTML elements already styled by Bootstrap:
<div class="container">
<div class="row">
<div class="col-md-12">
<form class="form-horizontal">
<div class="col-md-3 text-left">
<div class="form-group">
<label class="sr-only" for="exampleInputAmount">Search</label>
<div class="input-group">
<input type="text" class="form-control" id="exampleInputAmount" placeholder="Search">
<div class="input-group-addon"><i class="fa fa-search"></i></div>
</div>
</div>
</div>
<div class="col-md-6"></div>
<div class="col-md-3 text-right">
<button type="submit" class="btn btn-primary">+ add stuff</button>
</div>
</form>
</div>
</div>
</div>

Bootstrap: fixed vertical position of a responsive column?

I'm trying to fix the vertical position of a bootstrap column without success.
<div class="col-sm-9 col-xs-12 fixed">
<div class="row pad-20">
<div class="col-xs-6">
<button type="button" value="0" class="btn {{color1}} btn-lg btn-block choice">{{choice1}}</button>
</div>
<div class="col-xs-6">
<button type="button" value="1" class="btn {{color2}} btn-lg btn-block choice">{{choice2}}</button>
</div>
</div>
</div>
</div>
Where fixed is:
.fixed{
position: fixed;
bottom: 5px;
}
The proportion sm-9 and xs-12 are not respected ...
Any help?
Do you have a <div class="container"> around the markup you show? Also, in the markup you show there's an extra closing </div> tag.
Seems to be working in this JSFiddle I put together:
https://jsfiddle.net/o540r7cf/
HTML:
<div class="container">
<div class="row">
<div class="col-sm-9 col-xs-12 fixed">
<div class="row">
<div class="col-md-6 col-xs-6">
<button type="button" value="0" class="btn btn-primary btn-lg btn-block"> Choice 1</button>
</div>
<div class="col-md-6 col-xs-6">
<button type="button" value="1" class="btn btn-primary btn-lg btn-block">Choice 2</button>
</div>
</div>
</div>
</div>
</div>
CSS:
.fixed {
position: fixed;
bottom: 5px;
}

Resources