layout with twitter-bootstrap form - css

I have difficulties to arrange the css bootstrap form .
On top of the picture below is the layout I get and just under is the layout I would like to obtain:
http://s27.postimg.org/dfztgn35v/flow_Root3665.png
This is: the first column witn names aligned on their last letter, and aligned input fields on the left and on the right.
Here is the css I used:
<div class="well">
<form class="form-horizontal" method="post">
<fieldset>
<legend>Event</legend>
<div class="form-group">
<label for="input-append date" class="col-lg-1 control-label">Date</label>
<div class="col-lg-3">
<div class="input-group input-append date" id="startDatePicker">
<input type="text" class="form-control" name="datepicker" id="datepicker1" readonly style="background-color: white" /><span class="input-group-addon add-on"><span class="glyphicon glyphicon-calendar"></span></span>
</div>
</div>
<div class="form-group">
<label for="input-append type" class="col-lg-1 control-label">Type</label>
<div class="col-lg-2">
<select class="form-control" id="select">
<option>select1</option>
<option>select2</option>
</select>
</div>
</div>
<div class="form-group">
<label for="inputTitle" class="col-lg-1 control-label">Title</label>
<div class="col-lg-6">
<input kl_virtual_keyboard_secure_input="on" class="form-control" id="inputTitle" placeholder="Title" type="text" maxlength="30">
</div>
</div>
<div class="form-group">
<label for="textArea" class="col-lg-1 control-label">Description</label>
<div class="col-lg-6">
<textarea class="form-control" rows="3" id="textArea" placeholder="Description" maxlength="200"></textarea>
</div>
</div>
</div>
</fieldset>
</form>
</div>
Thanks!

With some minor CSS you can acheive that. See example.
#soForm input,
#soForm select {
height: 50px;
font-size: 16px;
-webkit-border-radius: 0;
border-radius: 0;
border: 4px solid #444;
}
#soForm textarea {
font-size: 16px;
-webkit-border-radius: 0;
border-radius: 0;
border: 4px solid #444;
}
#soForm .input-group-addon {
height: 50px;
font-size: 13px;
-webkit-border-radius: 0;
border-radius: 0;
border-right: 4px solid #444;
border-top: 4px solid #444;
border-bottom: 4px solid #444;
}
.btn.btn-submit {
border-radius: 0;
height: 50px;
width: 100px;
border: 4px solid #444;
}
#media (min-width: 768px) {
#soForm .soForm {
margin: 10px auto;
}
#soForm .control-label {
margin-top: 25px;
}
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="well">
<div class="container">
<form id="soForm" name="soForm">
<div class="form-group">
<label for="date" class="col-sm-2 control-label">Date</label>
<div class="col-sm-5">
<div class="input-group soForm">
<input type="text" class="form-control" id="date" /> <span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
</div>
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">Type</label>
<div class="col-sm-3">
<select class="form-control soForm" id="type">
<option>select1</option>
<option>select2</option>
</select>
</div>
</div>
<div class="form-group">
<label for="title" class="col-sm-2 control-label">Title</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="title" />
</div>
</div>
<div class="form-group">
<label for="description" class="col-sm-2 control-label">Description</label>
<div class="col-sm-10">
<textarea class="form-control soForm" rows="5" id="desc"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default btn-submit">Submit</button>
</div>
</div>
</form>
</div>
</div>

Related

Changing color of radio-button

In the default CSS code for radio buttonn, it is gray when it is not selected and is blue when it is selected:
I however need it to be black in both states. Thus, I have overriden SCSS for radio buttons. Here comes my code:
HTML:
<div class="col-md-2 col-sm-6">
<div class="row">
<div class="col-md-12">
<label>Earlier experience in this field?</label>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="radio">
<label><input type="radio" formControlName="earlierExperience" value="1">Yes</label>
</div>
</div>
<div class="col-md-6">
<div class="radio">
<label><input type="radio" formControlName="earlierExperience" value="0">No</label>
</div>
</div>
</div>
</div>
CSS:
input[type='radio']:after {
width: 15px;
height: 15px;
border-radius: 50%;
top: -2px;
left: -1px;
position: relative;
background-color:white;
display: inline-block;
visibility: visible;
border: 1px solid black;
}
input[type='radio']:checked:after {
border: 4.5px solid black;
}
The problem with this code is that the small circle in the middle of the checked button is not shown anymore:
Can you help me with this?
You can use the new property accent-color which sets the colour for the input. Broswer support is limited to Chrome and Firefox at the moment so you will create fallbacks for other browsers.
input {accent-color: black;}
input {
accent-color: black;
}
<div class="col-md-2 col-sm-6">
<div class="row">
<div class="col-md-12">
<label>Earlier experience in this field?</label>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="radio">
<label><input type="radio" formControlName="earlierExperience" value="1">Yes</label>
</div>
</div>
<div class="col-md-6">
<div class="radio">
<label><input type="radio" formControlName="earlierExperience" value="0">No</label>
</div>
</div>
</div>
</div>
For solution, you can use property filter in css.
input[type='radio'] {
filter: grayscale(100%) contrast(200%);
}
input[type='radio'] {
filter: grayscale(100%) contrast(200%);
}
<div class="col-md-2 col-sm-6">
<div class="row">
<div class="col-md-12">
<label>Earlier experience in this field?</label>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="radio">
<label>
<input
type="radio"
formControlName="earlierExperience"
value="1"
/>Yes
</label>
</div>
</div>
<div class="col-md-6">
<div class="radio">
<label>
<input
type="radio"
formControlName="earlierExperience"
value="0"
/>No
</label>
</div>
</div>
</div>
</div>
Custom solution with box-shadow, pseudo-element and input binding to label
.radio {
margin-left: 0.125em;
}
.radio label {
position: relative;
padding-left: 1.5em;
cursor: pointer;
}
.radio label::after {
content: '';
width: 1em;
height: 1em;
position: absolute;
top: 0;
left: 0.25em;
border-radius: 50%;
box-shadow: inset 0 0 0 2px black;
}
input[type='radio'] {
position: absolute;
visibility: hidden;
}
input[type='radio']:checked~label::after {
box-shadow: inset 0 0 0 2px black, inset 0 0 0 4px white, inset 0 0 0 10px rgb(0, 0, 0);
}
<div class="col-md-2 col-sm-6">
<div class="row">
<div class="col-md-12">
<label>Earlier experience in this field?</label>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="radio">
<input id="yes" type="radio" name="radio" formControlName="earlierExperience" value="1" />
<label for="yes"> Yes </label>
</div>
</div>
<div class="col-md-6">
<div class="radio">
<input id="no" type="radio" name="radio" formControlName="earlierExperience" value="0" />
<label for="no"> No </label>
</div>
</div>
</div>
</div>

input-group border doubling up in the middle

I am using bootstrap 4 input-group as shown below. I have changed the border-width to 10px. It seems like the border width in the middle is doubling up:
Is it possible to make the middle border as wide as the side borders?
.input-text {
border-width: 10px !important;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="centered-query">
<div class="row justify-content-center">
<div class="col-lg-9 col-12">
<div class="input-group">
<input type="text" class="form-control input-text">
<input type="text" class="form-control input-text">
<div class="input-group-append">
<button type="submit" class="btn">Go</button>
</div>
</div>
</div>
</div>
</div>
Override the left/right border for the first and second input
.input-text {
border-width: 10px !important;
}
.input-text.first {
border-right-width: 5px !important;
}
.input-text.second {
border-left-width: 5px !important;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="centered-query">
<div class="row justify-content-center">
<div class="col-lg-9 col-12">
<div class="input-group">
<input type="text" class="form-control input-text first">
<input type="text" class="form-control input-text second">
<div class="input-group-append">
<button type="submit" class="btn">Go</button>
</div>
</div>
</div>
</div>
</div>

How to set div cell to act like th?

Hello everyone I have form which contains few different group of fields. In order to keep them together I used div elements and make them act like table elements. I used this method to avoid table elements inside of the form. In other hand some people said this approach is the same basically since I made div's to act like a table. To be honest I'm not sure if this is the best option. Here is example of my code.
form {
width: 820px;
}
form.frmLayout fieldset {
border: #ccc 2px solid;
margin: 10px;
border-radius:3px;
}
form.frmLayout legend {
font-weight: bold;
background-color: #c8e2db;
border-radius:3px;
padding: 3px;
border: #ccc 2px solid;
}
form.frmLayout label {
float: left;
font-weight: bold;
display: block;
}
form.frmLayout input[type=text] {
text-align: left;
background-color: #c8e2db;
}
div.formItem {
margin-top: 5px;
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
background-repeat: repeat-x;
clear: both;
border-bottom: #ccc 2px dashed;
}
div.formItem:last-child{
border-bottom: none;
}
div.formTbl {
display: table;
width: 100%;
}
div.frRow {
display: table-row;
text-align: left;
}
div.frCell {
display: table-cell;
padding-top: 2px;
padding-bottom: 2px;
padding-left: 0px;
padding-right: 0px;
text-align: center;
}
div.frCell span {
font-weight: bold;
}
<form name="myForm" id="myForm" method="POST" action="#" class="frmLayout">
<input type="hidden" name="frmhs_id" id="frmhs_id" value="" />
<fieldset>
<legend>My Form</legend>
<div class="formItem">
<div class="formTbl">
<div class="frRow">
<div class="frCell" style="width:60%;">
</div>
<div class="frCell" style="width:40%;">
<div class="formTbl">
<div class="frRow">
<div class="frCell" style="width:40%;">
<span>Acoustic Reflex Thresholds</span>
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<span>500</span>
</div>
<div class="frCell" style="width:10%;">
<span>1000</span>
</div>
<div class="frCell" style="width:10%;">
<span>2000</span>
</div>
<div class="frCell" style="width:10%;">
<span>4000</span>
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td6" id="frmhs_td6" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td7" id="frmhs_td7" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td8" id="frmhs_td8" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td9" id="frmhs_td9" value="" size="4" maxlength="4" />
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td15" id="frmhs_td15" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td16" id="frmhs_td16" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td17" id="frmhs_td17" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td18" id="frmhs_td18" value="" size="4" maxlength="4" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="formItem">
<div style="float:left;">
<span><input type="submit" name="frmSubmit" id="frmhdSubmit" value="Submit"></span>
</div>
<div style="float:right;">
<span id="MsgFrm"></span>
</div>
</div>
</fieldset>
</form>
As you can see in my example above title Acoustic Reflex Thresholds is not on the center. Also I think that affects first set of div cells to change the width. I'm wondering how I can make title to go over entire length of div cell? If anyone knows how this can be fixed or is there better way to do this please let me know. Thanks in advance.
One of the limitations of css table layout is that you cannot simulate colspan, so the cells are going to be sized the same as the rest in its "column" even if its only 1 column in the row (as you can see with your "Acoustic Reflex Thresholds" heading).
What you can do is make the heading a table-caption instead of a row and that works, as you can see if you run the updated code snippet below.
There are 2 changes required:
CSS: Add the new class for the table caption
div.frCaption{
display: table-caption;
caption-side: top;
text-align: center;
font-weight: bold;
}
HTML: change the table-row to table-caption
In the row that contains with you "Acoustic Reflex Thresholds" heading:
Change the class from frRow to frCaption
Remove the frCell div altogether
[...right column...]
<div class="frCell" style="width:40%;">
<div class="formTbl">
<div class="frCaption ">
<span>Acoustic Reflex Thresholds</span>
</div>
<div class="frRow">
[... rest of rows...]
form {
width: 820px;
}
form.frmLayout fieldset {
border: #ccc 2px solid;
margin: 10px;
border-radius:3px;
}
form.frmLayout legend {
font-weight: bold;
background-color: #c8e2db;
border-radius:3px;
padding: 3px;
border: #ccc 2px solid;
}
form.frmLayout label {
float: left;
font-weight: bold;
display: block;
}
form.frmLayout input[type=text] {
text-align: left;
background-color: #c8e2db;
}
div.formItem {
margin-top: 5px;
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
padding-top: 5px;
padding-bottom: 5px;
background-repeat: repeat-x;
clear: both;
border-bottom: #ccc 2px dashed;
}
div.formItem:last-child{
border-bottom: none;
}
div.formTbl {
display: table;
width: 100%;
}
div.frRow {
display: table-row;
text-align: left;
}
div.frCell {
display: table-cell;
padding-top: 2px;
padding-bottom: 2px;
padding-left: 0px;
padding-right: 0px;
text-align: center;
}
div.frCell span {
font-weight: bold;
}
div.frCaption{
display: table-caption;
caption-side: top;
text-align: center;
font-weight: bold;
}
<form name="myForm" id="myForm" method="POST" action="#" class="frmLayout">
<input type="hidden" name="frmhs_id" id="frmhs_id" value="" />
<fieldset>
<legend>My Form</legend>
<div class="formItem">
<div class="formTbl">
<div class="frRow">
<div class="frCell" style="width:60%;">
</div>
<div class="frCell" style="width:40%;">
<div class="formTbl">
<div class="frCaption ">
<span>Acoustic Reflex Thresholds</span>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<span>500</span>
</div>
<div class="frCell" style="width:10%;">
<span>1000</span>
</div>
<div class="frCell" style="width:10%;">
<span>2000</span>
</div>
<div class="frCell" style="width:10%;">
<span>4000</span>
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td6" id="frmhs_td6" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td7" id="frmhs_td7" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td8" id="frmhs_td8" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td9" id="frmhs_td9" value="" size="4" maxlength="4" />
</div>
</div>
<div class="frRow">
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td15" id="frmhs_td15" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td16" id="frmhs_td16" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td17" id="frmhs_td17" value="" size="4" maxlength="4" />
</div>
<div class="frCell" style="width:10%;">
<input type="text" name="frmhs_td18" id="frmhs_td18" value="" size="4" maxlength="4" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="formItem">
<div style="float:left;">
<span><input type="submit" name="frmSubmit" id="frmhdSubmit" value="Submit"></span>
</div>
<div style="float:right;">
<span id="MsgFrm"></span>
</div>
</div>
</fieldset>
</form>

CSS Reverse transition and select previous sibling

Bootstrap container has two forms horizontally.
Hovering over Form1 will increase the width and decreases the width of form2.
but reverse is not happening. Any suggestions please.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
#row{
background-color: lightblue;
border-style: groove;
}
#form1{
background-color: lightgreen;
width: 50%;
transition: width 0.75s ease;
}
#form1:hover{
width: 75%;
}
#form1:hover + #form2{
width: 25%
}
#form2{
background-color: orange;
width: 50%;
transition: width 0.75s ease;
}
#form2:hover{
width: 75%;
}
#form2:hover ~ #form1{
width: 25%
}
</style>
</head>
<body>
<div class="container" >
<div id="row" class="row" >
<div id="form1" class="col-sm-6">
<!-- form1 -->
<form class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Enter email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label><input type="checkbox"> Remember me</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
</div>
<div id="form2" class="col-sm-6">
<!-- form 2 -->
<form class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="email">Email:</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="email" placeholder="Enter email">
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="pwd">Password:</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label><input type="checkbox"> Remember me</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
Please see the below image. When hovering on Green form, form goes left to right ,Orange form decreases the width and Green form increases the width but this is not happening while hovering on Orange form(Reverse direction).
Basically I'm trying to achieve form like THIS
You can do this with flexbox. As Selva has mentioned, CSS can only select the next sibling, not the previous. However, with flexbox this is much easier:
.flexible{display: flex; flex-direction: row;}
#form1:hover{
width: 100%;
}
#form2:hover{
width: 100%;
}
https://jsfiddle.net/2g4krj0f/
The solution with pure CSS exists. You need to define css-rule for selector which selects form1 when this form is unhovered while row is hovered: #row:hover > #form1:not(:hover)
#row:hover > #form1:not(:hover){
width: 25%;
}
http://www.codeply.com/go/0Q2gFDoc4y
look at snippet (for some reason it works in full screen mode):
#row{
background-color: lightblue;
border-style: groove;
}
#form1{
background-color: lightgreen;
width: 50%;
transition: width 0.75s ease;
}
#form1:hover{
width: 75%;
}
#form1:hover + #form2{
width: 25%
}
#form2{
background-color: orange;
width: 50%;
transition: width 0.75s ease;
}
#form2:hover{
width: 75%;
}
#row:hover > #form1:not(:hover){
width: 25%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container" >
<div id="row" class="row" >
<div id="form1" class="col-xs-6">
<!-- form1 -->
<form class="form-horizontal">
<div class="form-group">
<label class="control-label col-xs-2" for="email">Email:</label>
<div class="col-xs-10">
<input type="email" class="form-control" id="email" placeholder="Enter email">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="pwd">Password:</label>
<div class="col-xs-10">
<input type="password" class="form-control" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<div class="checkbox">
<label><input type="checkbox"> Remember me</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
</div>
<div id="form2" class="col-xs-6">
<!-- form 2 -->
<form class="form-horizontal">
<div class="form-group">
<label class="control-label col-xs-2" for="email">Email:</label>
<div class="col-xs-10">
<input type="email" class="form-control" id="email" placeholder="Enter email">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-2" for="pwd">Password:</label>
<div class="col-xs-10">
<input type="password" class="form-control" id="pwd" placeholder="Enter password">
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<div class="checkbox">
<label><input type="checkbox"> Remember me</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-xs-offset-2 col-xs-10">
<button type="submit" class="btn btn-default">Submit</button>
</div>
</div>
</form>
</div>
</div>
</div>

Bootstrap multiple "fixed-width inputs" in 1 Column

I want to achieve that the following is on 1 line
http://jsfiddle.net/strgga/6yanLf8q/30/
.rightstraight {
border-bottom-right-radius: 0px;
border-top-right-radius: 0px;
-moz-border-radius-topright: 0;
-moz-border-radius-bottomright: 0;
}
.leftstraight {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
-moz-border-radius-topleft: 0;
-moz-border-radius-bottomleft: 0;
}
.input-group-addon.primary {
color: rgb(255, 255, 255);
background-color: rgb(50, 118, 177);
border-color: rgb(40, 94, 142);
}
.input-group-addon.success {
color: rgb(255, 255, 255);
background-color: rgb(92, 184, 92);
border-color: rgb(76, 174, 76);
}
.input-group-addon.info {
// color: rgb(255, 255, 255);
// background-color: rgb(57, 179, 215);
// border-color: rgb(38, 154, 188);
border: 1px solid #ccc;
background-color: rgb(255, 255, 255);
color: rgb(0, 0, 0);
}
.input-group-addon.warning {
color: rgb(255, 255, 255);
background-color: rgb(240, 173, 78);
border-color: rgb(238, 162, 54);
}
.input-group-addon.danger {
color: rgb(255, 255, 255);
background-color: rgb(217, 83, 79);
border-color: rgb(212, 63, 58);
}
.has-feedback .form-control-feedback {
right: 0px !important;
top: 0;
padding-right: 4px !important;
}
.form-control-feedback {
width: 22px !important;
text-align: left !important;
}
.has-feedback .form-control {
padding-right: 22px !important;
}
.righta {
text-align: right;
}
.middla {
text-align: center;
}
.slim {
width: 61px;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<h2>Gratisofferte</h2>
<form role="form" class="form-horizontal">
<div id="form1">
<div class="form-group ">
<div class="col-sm-4 col-xs-5">
<label>Aktuelle Adresse</label>
<div class=" has-feedback has-success">
<input class="rightstraight form-control" placeholder="z.B. Paradiesstrasse 10" type="text" id="n_adr">
<span id="fname1" class="glyphicon form-control-feedback glyphicon-ok"></span>
</div>
</div>
<div class="col-sm-3 col-xs-4" style="margin-left:-30px;">
<label>PLZ</label>
<input class="leftstraight form-control" placeholder="PLZ" type="text" id="n_plz">
</div>
<div class="col-sm-5 col-xs-3">
<label>Zimmer</label>
<select class="slim form-control">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<label>Etage</label>
<select class="slim form-control">
<option>E</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
</select>
<label>Lift</label>
<select class="slim form-control">
<option>ja</option>
<option>nein</option>
</select>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<button id="next" type="submit" class="btn btn-info pull-right">weiter</button>
</div>
</div>
</div>
</form>
<hr>
</div>
Why bootstrap doesn't put the selects on one line? They are in a column bounded?
Check this you need like this way..DEMO
<div class="container">
<h2>Gratisofferte</h2>
<form role="form">
<div class="form-group col-md-3">
<label>Aktuelle Adresse</label>
<input class="form-control " placeholder="z.B. Paradiesstrasse 10" type="text" id="n_adr">
<span id="fname1" class="glyphicon form-control-feedback glyphicon-ok"></span>
</div> <div class="form-group col-md-2">
<label>PLZ</label>
<input class="leftstraight form-control" placeholder="PLZ" type="text" id="n_plz">
</div>
<div class="form-group col-md-2">
<label>Zimmer</label>
<select class="slim form-control"> <option>1</option> <option>2</option> <option>3</option> <option>4</option></select>
</div>
<div class="form-group col-md-2">
<label>Etage</label>
<select class="slim form-control"> <option>E</option><option>1</option> <option>2</option> <option>3</option> <option>4</option></select></div>
<div class="form-group col-md-2">
<label>Lift</label>
<select class="slim form-control"> <option>ja</option> <option>nein</option></select>
</div>
<div class="form-group col-md-1">
<button id="next" type="submit" class="btn btn-info pull-right">weiter</button>
</div>
</form>
<hr>
</div>
The answer is given from christina in this post
Two inputs same form column taking all the cell width Bootstrap 3
The solution lies in the nesting of rows, therefor making it thiner=exacter than within the 12-part grid. So you put a first grid in 4-4-4 and than you can create a grid in each of this grids again. this way you can achieve more than a 12-tel of a grid. For example you can split the last column in 5-5-1 which results in a total break-down of 13 % - 13 % and 2.7 % (= a 12-tel of 0.33).
<div class="container">
<h2>Gratisofferte</h2>
<form role="form" class="form-horizontal">
<div id="form1">
<div class="form-group ">
<div class="col-sm-4 col-xs-5">
<label>Aktuelle Adresse</label>
<div class=" has-feedback has-success">
<input class="rightstraight form-control" placeholder="z.B. Paradiesstrasse 10" type="text" id="n_adr">
<span id="fname1" class="glyphicon form-control-feedback glyphicon-ok"></span></div>
</div>
<div class="col-sm-3 col-xs-4" style="margin-left:-30px;">
<label>PLZ</label>
<input class="leftstraight form-control" placeholder="PLZ" type="text" id="n_plz">
</div>
<div class="col-sm-5 col-xs-3">
<div class="row">
<div class="col-sm-4 col-xs-4" style="">
<label>Zimmer</label>
<select class="slim form-control"> <option>1</option> <option>2</option> <option>3</option> <option>4</option></select>
</div>
<div class="col-sm-4 col-xs-4" style="margin-left:-30px;">
<label>Etage</label>
<select class="slim form-control"> <option>E</option><option>1</option> <option>2</option> <option>3</option> <option>4</option></select>
</div>
<div class="col-sm-4 col-xs-4" style="margin-left:-30px;">
<label>Lift</label>
<select class="slim form-control"> <option>ja</option> <option>nein</option></select>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<button id="next" type="submit" class="btn btn-info pull-right">weiter</button>
</div>
</div>
</div>
</form>
<hr>
</div>
http://jsfiddle.net/strgga/6yanLf8q/33/
As for the question i don't know any way to put above-labels in place without putting the input-label combo in a seperate col. maybe with custom css only.

Resources