Add button inside an Input Tag - css

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>

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

Print scrollable boootstrap modal

I have one modal in my new web application ,I want to print the modal content,the modal is scrollable.Now i can only print the content that is viewable.What are the corrections that i should make in my style.css.
index.html
<div class="modal fade" id="myModal" role="dialog">
<div class="modal-dialog ">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 ALIGN="center" class="modal-title">MR FINANCE</h4>
</div>
<div class="modal-body" >
<div class="row">
<div class="col-xs-6">
<div class="form-group">
Name:<input type="text" ng-model="cstmrname" class="form-control" placeholder="Jane Doe" >
</div>
<div class="form-group">
Phone:<input type="number"ng-model="cstmrphone" class="form-control" placeholder="8086502009">
</div>
</div>
<div class="col-xs-6 ">
<div class="text-right">
<p ><STRONG >GLID:{{(GLID.GLID-0)+1}}</STRONG></p>
{{date | date:'MM-dd-yyyy'}}<br/>
{{place}}
</div>
<div class="form-group">
Address: <textarea type="text" class="form-control" ng-model="cstmradress" rows="2"></textarea>
</div>
</div>
</div>
<hr>
<div class="row">
<div class="col-xs-12">
<h4 align="center">
Ornaments
</h4>
<form class="form-inline form-group">
<fieldset data-ng-repeat="choice in choices">
<div class="col-xs-3">
<div class="form-group">
<select class="form-control" id="optioin1" ng-model="choice.option1" >
<option value="Ring" >Ring</option>
<option value="Earings" >Earings</option>
<option value="Chains">Chains</option>
<option value="Necklaces">Necklaces</option>
<option value="Bangles">Bangles</option>
</select>
</div>{{choice.option1}}
</div>
<div class="col-xs-4">
<div class="input-group">
<input type="number" step="0.01" ng-model="choice.weight" class="form-control" placeholder="Weight" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2">gm</span>
</div>
</div>
<div class="col-xs-4 pull-right">
<button class="btn btn-default" ng-show="$last" ng-click="removeChoice() "><span class="glyphicon glyphicon-minus" aria-hidden="true"></span></button>
<button class="btn btn-default" ng-show="$last" ng-click="addNewChoice()"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
</div>
</fieldset>
</form>
</div>
</div>
<div class="row">
<div class="col-xs-6">
<p class="text-left"> Total Numbers:{{ choices.length}}</p>
</div>
<div class="col-xs-6"><p>Total Weight: {{total(number)}}gm</p>
</div>
</div>
<hr>
<form align="center" class="form-inline">
PledgeAmt:
<div class="input-group">
<input type="number" ng-model="pledgeamt" class="form-control" placeholder="{{(total()*2050)-3000}}-{{total()*2050}}" >
<span class="input-group-addon" id="basic-addon2">RS</span>
</div>
</form>
<hr>
<div class="row">
<h5 align="center"> Interest</h5>
<div class="col-xs-6">
<p> 1-3Month:{{ intrst[0].INTR1}}%({{(pledgeamt/100)*1}}RS/day)</p>
</div>
<div class="col-xs-6">
<p > 3-12Month:{{ intrst[0].INTR2}}%({{(pledgeamt/100)*2}}RS/day)</p>
</div>
</div>
<tr ng-repeat="ornament in data">
<td>{{ornament.GLID}}</td>
<td>{{ornament.WEIGHT}}</td>
<td>{{ornament.TOTGRAM}}</td>
</tr>
<div class="modal-footer">
<button type="button" ng-click="insertvalue()" class="btn btn-default" >Submit</button>
<button type="button" class="btn btn-default" onclick="js:window.print()">print modal content</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</div>
style.css
.printable { display: none; }
#media print
{ .modal-footer,
.non-printable { display: none; }
.printable1 {
width: auto;
height: auto;
overflow: visible !important; }
}
You implementation of your css is the right approach but you will need to make whatever the class that currently has the scroll, visible when you print out the document.
If you wanted the css to be changed but not the html:
#media print {
/* if modal-body is your scrollable class */
.modal-body {
width: auto;
height: auto;
overflow: visible !important;
}
}
Code pen link

Bootstrap grid system works strangely

This is my code :
<div id="loginbox" class="mainbox col-md-6 col-md-offset-3 ">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">Sign In</div>
<div class="forget">Forgot password?</div>
</div>
<div class="panel-body" >
<div id="login-alert" class="alert alert-danger col-sm-12"></div>
<form id="loginform" class="form-horizontal" role="form">
<!-- id / pw -->
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="login-username" type="text" class="form-control" name="username" value="" placeholder="username or email">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input id="login-password" type="password" class="form-control" name="password" placeholder="password">
</div>
<div class="form-group">
<!-- Button -->
<div class="col-sm-12 controls">
<div class="row">
<a id="btn-login" href="#" class="btn btn-success col-xs-12"> Login</a>
<a id="btn-fblogin" href="#" class="btn btn-primary col-xs-12"><i class="icon-facebook"></i>Login with Facebook</a>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12 control">
<div class="signup">
Don't have an account?
<a href="#" id="signuplink">
Sign Up Here
</a>
</div>
</div>
</div>
</form>
</div> <!-- <div style="padding-top:30px" class="panel-body" > -->
</div>
</div>
The only thing that I changed is <div id="loginbox" class="mainbox col-md-6 col-md-offset-3 ">
And here is before/after :
Before I inserted col-md-6 col-md-offset-3, the blue-shaded box looks balanced.
After I inserted col-md-6 col-md-offset-3, it looks unbalanced.
Why does it happen? I think that grid should work well(login box should be located at center" because it means `3(offset) - 6 - 3(offset)'.
Need your help.
Its because your loginbox does not have 12 columns in total as you specified 6+3(offset) =9
I would suggest this way as I dont like using offset
<div class="col-md-3 "></div>
<div id="loginbox" class="mainbox col-md-6">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">Sign In</div>
<div class="forget">Forgot password?</div>
</div>
<div class="panel-body" >
<div id="login-alert" class="alert alert-danger col-sm-12"></div>
<form id="loginform" class="form-horizontal" role="form">
<!-- id / pw -->
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="login-username" type="text" class="form-control" name="username" value="" placeholder="username or email">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input id="login-password" type="password" class="form-control" name="password" placeholder="password">
</div>
<div class="form-group">
<!-- Button -->
<div class="col-sm-12 controls">
<div class="row">
<a id="btn-login" href="#" class="btn btn-success col-xs-12"> Login</a>
<a id="btn-fblogin" href="#" class="btn btn-primary col-xs-12"><i class="icon-facebook"></i>Login with Facebook</a>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12 control">
<div class="signup">
Don't have an account?
<a href="#" id="signuplink">
Sign Up Here
</a>
</div>
</div>
</div>
</form>
</div> <!-- <div style="padding-top:30px" class="panel-body" > -->
</div>
</div>
<div class="col-md-3 "></div>
Here's my take: giving it a fluid container and a couple extra rows to center things up:
<div class="container-fluid">
<div class="row">
<div class="brown-row col-md-8 col-md-offset-2">
<div class="row">
<div id="loginbox" class="mainbox col-md-6 col-md-offset-3 ">
<div class="panel panel-info">
<div class="panel-heading">
<div class="panel-title">Sign In</div>
<div class="forget">Forgot password?</div>
</div>
<div class="panel-body">
<div id="login-alert" class="alert alert-danger col-sm-12"></div>
<form id="loginform" class="form-horizontal" role="form">
<!-- id / pw -->
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input id="login-username" type="text" class="form-control" name="username" value="" placeholder="username or email">
</div>
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
<input id="login-password" type="password" class="form-control" name="password" placeholder="password">
</div>
<div class="form-group">
<!-- Button -->
<div class="col-sm-12 controls">
<div class="row">
<a id="btn-login" href="#" class="btn btn-success col-xs-12"> Login</a>
<a id="btn-fblogin" href="#" class="btn btn-primary col-xs-12"><i class="icon-facebook"></i>Login with Facebook</a>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-12 control">
<div class="signup">
Don't have an account?
<a href="#" id="signuplink">
Sign Up Here
</a>
</div>
</div>
</div>
</form>
</div>
<!-- <div style="padding-top:30px" class="panel-body" > -->
</div>
</div>
</div>
</div>
</div>
</div>
and css:
body {
background: #634a16;
}
.brown-row {
background: #9e7623;
}
#loginbox {
margin-top: 50px
}

How to set bootstrap form with multi controls aligned at same row (and responsive)

I'd like to draw a table using bootstrap css and looks like this:
After reading many tutorials on internet, I didn't find any examples directly support multi controls aligned as the pictrue above (either using .form-horizontal or .form-inline).
Can anyone show me an example please ?
You can also use grid system without adding any customized styles:
<form>
<div class="row">
<div class="col-md-1 col-sm-1 form-group">
<label>Name</label>
</div>
<div class="col-md-5 col-sm-11 form-group">
<input type="text" class="form-control" />
</div>
<div class="col-md-1 col-sm-1 form-group">
<label>Age</label>
</div>
<div class="col-md-5 col-sm-11 form-group">
<input type="text" class="form-control" />
</div>
</div>
<div class="row">
<div class="col-md-1 col-sm-1 form-group">
<label>Sex</label>
</div>
<div class="col-md-5 col-sm-11 form-group">
<input type="text" class="form-control" />
</div>
<div class="col-md-1 col-sm-1 form-group">
<label>Job</label>
</div>
<div class="col-md-5 col-sm-11 form-group">
<input type="text" class="form-control" />
</div>
</div>
</form>
Results:
large
small
Smallest
#ineztia: try this source code and let me know.
.form-row > .control-label {
margin-top: 5px;
}
.form-row > .input-text {
margin-bottom: 5px;
}
#media screen (min-width: 768px) {
.form-row > .control-label {
margin-top: 0;
}
.form-row > .input-text {
margin-bottom: 0;
}
}
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-sm-12">
<form class="form-horizontal">
<fieldset>
<!-- Form Name -->
<legend>Form Name</legend>
<!-- Text input-->
<div class="form-group">
<div class="form-row">
<label class="col-lg-2 col-md-2 col-sm-2 col-xs-3 control-label">Name</label>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-9 input-text">
<input type="text" placeholder="Name..." class="form-control input-md">
</div>
</div>
<div class="form-row">
<label class="col-lg-2 col-md-2 col-sm-2 col-xs-3 control-label">Age</label>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-9 input-text">
<input type="text" placeholder="Age..." class="form-control input-md">
</div>
</div>
</div>
<!--/form-group-->
<!-- Text input-->
<div class="form-group">
<div class="form-row">
<label class="col-lg-2 col-md-2 col-sm-2 col-xs-3 control-label">Sex</label>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-9 input-text">
<input type="text" placeholder="Sex..." class="form-control input-md">
</div>
</div>
<div class="form-row">
<label class="col-lg-2 col-md-2 col-sm-2 col-xs-3 control-label">Job</label>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-9 input-text">
<input type="text" placeholder="Job..." class="form-control input-md">
</div>
</div>
</div>
<!--/form-group-->
<!-- Button (Double) -->
<div class="form-group text-right">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<button name="btn-ok" class="btn btn-cancel btn-success">OK</button>
<button name="btn-cancel" class="btn btn-cancel btn-danger">Cancel</button>
</div>
</div>
<!--/form-group-->
</fieldset>
<!--/fieldset-->
</form>
<!--/form-->
</div>
</div>
</div>

Embed a search form in Bootstrap 3 panel heading

I'm attempting to embed a search form at the right side of a panel heading:
<div class="panel-heading">
<h3 class="panel-title">Results <span class="badge">6</span></h3>
<form class="form-inline pull-right" role="search" method="get" action="/tbl">
<div class="form-group">
<input type="text" name="criteria" class="form-control" value="<%= params[:criteria] if params[:criteria] %>" placeholder="<%= params[:criteria]? params[:criteria] : 'Enter search criteria (e.g. FOOBAR_%)' %>">
<div class="input-group-btn">
<button class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
Unfortunately, I'm having alignment issues:
In Safari (8.0.3):
In Firefox (35.0.1):
Is there a way to do this, preferably without custom CSS?
JSFiddle
Almost, see this fiddle
I put the heading and search box into col divs, but id have to add a little padding to he title to get it to line up with the search box
CSS:
.padFix{
padding-top:8px;
}
HTML:
<div class="panel-heading ">
<div class="row">
<div class="col-sm-6">
<h3 class="panel-title padFix">Results <span class="badge">6</span></h3></div>
<div class="col-sm-6">
<form role="search" method="get" action="/tbl">
<div class="input-group">
<input type="text" name="criteria" class="form-control" value="<%= params[:criteria] if params[:criteria] %>" placeholder="<%= params[:criteria]? params[:criteria] : 'Enter search criteria (e.g. FOOBAR_%)' %>">
<div class="input-group-btn">
<button class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</div>
</div>
</div>
Here am sharing my answer, this might be useful
JS Fiddle
Here is the code
HTML
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<h4 class="panel-title pull-left" style="padding-top: 7.5px;">
Header
</h4>
<div class="btn-group pull-right">
<input type="text" class="custom_input">
<button class="btn btn-success pull-right" style="height: 30px;">
Search
</button>
</div>
</div>
<div class="panel-body">
Content Body
</div>
<div class="panel-footer">
Content Footer
</div>
</div>
</div>
</div>
CSS
.custom_input {
padding: 4px 5px;
border: 1px solid #d3e0e9;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
border-right: none;
height: 30px;
}
thank You :-)

Resources