Bootstrap 3 Form not aligning correctly - css

I am trying to build a form group but they are not aligned correctly with Bootstrap 3.
I am trying to aligned them vertically. This is giving me a nightmare so need some of your help
Please see below for screen shot
Below is the code for the form
<div class="container">
<h1>Edit Profile</h1>
<hr>
<div class="row">
<!-- left column -->
<div class="col-md-3">
<div class="text-center">
<img src="//placehold.it/100" class="avatar img-circle" alt="avatar">
<h6>Upload a different photo...</h6>
<input type="file" class="form-control">
</div>
</div>
<!-- edit form column -->
<div class="col-md-9 personal-info">
<!-- <div class="alert alert-info alert-dismissable">
<a class="panel-close close" data-dismiss="alert">×</a>
<i class="fa fa-coffee"></i>
This is an <strong>.alert</strong>. Use this to show important messages to the user.
</div> -->
<h3>Personal info</h3>
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-lg-3 control-label">First name:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="Jane">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Last name:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="Bishop">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Company:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Email:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="janesemail#gmail.com">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Time Zone:</label>
<div class="col-lg-8">
<div class="ui-select">
<select id="user_time_zone" class="form-control">
<option value="Hawaii">(GMT-10:00) Hawaii</option>
<option value="Alaska">(GMT-09:00) Alaska</option>
<option value="Pacific Time (US & Canada)">(GMT-08:00) Pacific Time (US & Canada)</option>
<option value="Arizona">(GMT-07:00) Arizona</option>
<option value="Mountain Time (US & Canada)">(GMT-07:00) Mountain Time (US & Canada)</option>
<option value="Central Time (US & Canada)" selected="selected">(GMT-06:00) Central Time (US & Canada)</option>
<option value="Eastern Time (US & Canada)">(GMT-05:00) Eastern Time (US & Canada)</option>
<option value="Indiana (East)">(GMT-05:00) Indiana (East)</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Username:</label>
<div class="col-md-8">
<input class="form-control" type="text" value="janeuser">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Password:</label>
<div class="col-md-8">
<input class="form-control" type="password" value="11111122333">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Confirm password:</label>
<div class="col-md-8">
<input class="form-control" type="password" value="11111122333">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<input type="button" class="btn btn-primary" value="Save Changes">
<span></span>
<input type="reset" class="btn btn-default" value="Cancel">
</div>
</div>
</form>
</div>
</div>
</div>
<hr>
my css sheet
/* CSS declarations go here */
.stylish-input-group .input-group-addon{
background: white !important;
}
.stylish-input-group .form-control{
border-right:0;
box-shadow:0 0 0;
border-color:#ccc;
}
.stylish-input-group button{
border:0;
background:transparent;
}
.navbar .navbar-nav {
display: inline-block;
float: none;
}
.navbar .navbar-collapse {
text-align: center;
}
* {
margin-bottom: 0px;
margin-top:0px;
margin-right: 0px;
margin-left: 0px;
}
.bg{
background: url(fundog.jpg);
background-size: cover;
color: white;
height: 500px;
margin-bottom: 0px;
margin-top:0px;
}
.navbar{
margin-bottom: 0px;
margin-top:0px;
}
.help{
text-align: right;
margin-bottom: 0px;
height: 300px;
}
.spread{margin-bottom: 0px;}
body {
/* set this equal to navbar's height */
}
.usp{
text-align: center;
}
.row {
display: table;
}
[class*="col-"] {
float: none;
display: table-cell;
vertical-align: top;
}
.profile{
margin-bottom: 100px;
margin-top:30px;
margin-right: 100px;
margin-left: 100px;
}

Your own css is causing problems:
[class*="col-"] {
float: none;
display: table-cell;
vertical-align: top;
}
Specifically, your combination of float:none and display: table-cell. Remove them and let bootstrap lay them out how it normally does.
Also not sure about setting everything's margin to zero. Like it or not, Bootstrap utilises negative margins to correctly layout some of its classes.

Here's the updated version that has your header, and all of the columns inline vertically.
http://www.bootply.com/b38G8GZgjw
Here's the code in case bootply is not available:
<div class="container">
<h1>Edit Profile</h1>
<hr>
<div class="row">
<!-- left column -->
<div class="col-md-3">
<div class="text-center">
<img src="//placehold.it/100" class="avatar img-circle" alt="avatar">
<h6>Upload a different photo...</h6>
<input type="file" class="form-control">
</div>
</div>
<!-- edit form column -->
<div class="col-md-9 personal-info">
<!-- <div class="alert alert-info alert-dismissable">
<a class="panel-close close" data-dismiss="alert">×</a>
<i class="fa fa-coffee"></i>
This is an <strong>.alert</strong>. Use this to show important messages to the user.
</div> -->
<div class="row">
<h3 class="col-lg-3 text-right">Personal info</h3>
</div>
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-lg-3 control-label">First name:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="Jane">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Last name:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="Bishop">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Company:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Email:</label>
<div class="col-lg-8">
<input class="form-control" type="text" value="janesemail#gmail.com">
</div>
</div>
<div class="form-group">
<label class="col-lg-3 control-label">Time Zone:</label>
<div class="col-lg-8">
<div class="ui-select">
<select id="user_time_zone" class="form-control">
<option value="Hawaii">(GMT-10:00) Hawaii</option>
<option value="Alaska">(GMT-09:00) Alaska</option>
<option value="Pacific Time (US & Canada)">(GMT-08:00) Pacific Time (US & Canada)</option>
<option value="Arizona">(GMT-07:00) Arizona</option>
<option value="Mountain Time (US & Canada)">(GMT-07:00) Mountain Time (US & Canada)</option>
<option value="Central Time (US & Canada)" selected="selected">(GMT-06:00) Central Time (US & Canada)</option>
<option value="Eastern Time (US & Canada)">(GMT-05:00) Eastern Time (US & Canada)</option>
<option value="Indiana (East)">(GMT-05:00) Indiana (East)</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Username:</label>
<div class="col-md-8">
<input class="form-control" type="text" value="janeuser">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Password:</label>
<div class="col-md-8">
<input class="form-control" type="password" value="11111122333">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Confirm password:</label>
<div class="col-md-8">
<input class="form-control" type="password" value="11111122333">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label"></label>
<div class="col-md-8">
<input type="button" class="btn btn-primary" value="Save Changes">
<span></span>
<input type="reset" class="btn btn-default" value="Cancel">
</div>
</div>
</form>
</div>
</div>
</div>

Related

Make bootstrap input on horizontal form absolute positioned without affecting width?

I'm using a horizontal bootstrap form and need a <input> absolute positioned for reasons too boring to explain. However, I'm battling getting it the same width as it used to be prior to absolute. So in the linked example, I want the password field to be the same width as the email field.
<form class="form-horizontal" style="max-width: 400px">
<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 abs" 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>
CSS:
.abs {
position: absolute;
width: inherit; /* 100%; */
}
How can I modify this fiddle?
jsFiddle
Using Louis' answer as inspiration, I think I was able to simplify this a little bit.
.abs-container {
position: absolute;
width: 100%;
padding-right: 30px;
}
Seems to work fine regardless of width of the form as well.
https://jsfiddle.net/8aco78L7/4/
There is one way to do it, although it does require a few divs.
The idea is to not apply the position: absolute property to the input element itself but to a container which has the same structure as the form. This way, we can be certain they will both always share the same size.
.password-container {
width: 100%;
position: absolute;
padding-left: 15px;
}
.password-container > .form-horizontal {
max-width: 400px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form class="form-horizontal" style="max-width: 400px">
<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="password-container">
<div class="form-horizontal">
<div class="form-group">
<div class="col-sm-10 col-md-offset-2">
<input type="password" class="form-control abs" id="pwd" placeholder="Enter password">
</div>
<div>
</div>
</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>
Since it only uses divs semantics is not affected.
.col-sm-10 {
position: relative;
}
input {
max-width: 400px;
}
.abs {
position: absolute;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<form class="form-horizontal" style="max-width: 400px">
<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 abs" 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>

With Bootstrap 4, how to prevent form groups from overlapping on one another?

I'm using Bootstrap 4 to create a Profile Edit form in my React app..
The form looks fine on a large display, but when on a small display like mobile, the form-groups are overlapping. See the problem image below, notice how the Profile Photo placeholder image is on top of First Name when it should be pushing First Name down and not overlapping.
Am I doing something wrong with the bootstrap Grid system or with form-groups?
JSFiddle: https://jsfiddle.net/v9fpfxyo/
CORRECT:
PROBLEM:
code from JSFiddle:
<div class="container">
<form>
<div class="row">
<div class="col-lg-3 col-sm-12">
<div class="form-group" style="height: 100%;">
<label for="files">Change your profile photo</label>
<span>
<div class="" style="width: 100%; height: 100%; font-size: 0px; margin-bottom: 1rem; background-color: rgb(29, 161, 242); background-image: url("https://abs.twimg.com/a/1498195419/img/t1/highline/empty_state/owner_empty_avatar.png"); background-position: 50% center;">
<!-- react-text: 85 -->Try dropping some files.<!-- /react-text --><input type="file" accept="image/jpeg, image/png" multiple="" style="display: none;">
</div>
<button type="button" class="btn btn-secondary btn-sm btn-block">Upload new Photo</button><!-- react-text: 88 --><!-- /react-text -->
</span>
</div>
</div>
<div class="col-lg-9 col-sm-12">
<div class="form-group">
<label>First Name</label>
<div><input type="text" name="first_name" value="XXX" placeholder="First Name" class="form-control"></div>
</div>
<div class="form-group">
<label>Last Name</label>
<div><input type="text" name="last_name" value="XXX" placeholder="Last Name" class="form-control"></div>
</div>
</div>
</div>
<div class="row row justify-content-end">
<div class="col-lg-9 col-sm-12"><button type="submit" class="btn btn-primary">Save Changes</button></div>
</div>
</form>
</div>
I had this kinda issue a lot. the way i dealt with them is using media queries. Add a class to the right grid (col-lg-9 col-sm-12). And on smaller screens #media (min-width: 780px) give the class margin-top: 30px;
Let me know if this works for you
Set The Margin OR Apply Css Code media width for mobile device and give the margin for it.
margin-top: 110px;
Example:
<div class="col-lg-9 col-sm-12">
<div class="form-group" style="margin-top: 110px;">
<label>First Name</label>
<div><input type="text" name="first_name" value="XXX" placeholder="First Name" class="form-control"></div>
</div>
<div class="form-group">
<label>Last Name</label>
<div><input type="text" name="last_name" value="XXX" placeholder="Last Name" class="form-control"></div>
</div>
</div>
</div>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<form>
<div class="row">
<div class="col-lg-3 col-sm-12">
<div class="form-group" style="height: 100%;">
<label for="files">Change your profile photo</label>
<span>
<div class="" style="width: 100%; height: 100%; font-size: 0px; margin-bottom: 1rem; background-color: rgb(29, 161, 242); background-image: url("https://abs.twimg.com/a/1498195419/img/t1/highline/empty_state/owner_empty_avatar.png"); background-position: 50% center;">
<!-- react-text: 85 -->Try dropping some files.<!-- /react-text --><input type="file" accept="image/jpeg, image/png" multiple="" style="display: none;">
</div>
<button type="button" class="btn btn-secondary btn-sm btn-block">Upload new Photo</button><!-- react-text: 88 --><!-- /react-text -->
</span>
</div>
</div>
<div class="col-lg-9 col-sm-12">
<div class="form-group" style="margin-top: 110px;">
<label>First Name</label>
<div><input type="text" name="first_name" value="XXX" placeholder="First Name" class="form-control"></div>
</div>
<div class="form-group">
<label>Last Name</label>
<div><input type="text" name="last_name" value="XXX" placeholder="Last Name" class="form-control"></div>
</div>
</div>
</div>
<div class="row row justify-content-end">
<div class="col-lg-9 col-sm-12"><button type="submit" class="btn btn-primary">Save Changes</button></div>
</div>
</form>
</div>

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>

Space between elements using bootstrap

EDIT:
I have updated my demo on JsFiddle please have a look at it.
JSFiddle Demo
I'm not sure what is it that causing the space between inputs and you can see its very inconsistency and give space, what is it that is missing?
CodePen Demo
<div class="col-md-12">
<div class="tab-content">
<div class="tab-pane active cont" id="we">
<span style="float: right; padding: 4px 6px;"><a href='javascript:history.go(-1)'>Go Back to Previous Page</a> </span>
<span style="float: right; padding: 4px 6px;"><font color="red">*</font> Indicates required field</span>
<div class="cl-mcont">
<div class="row">
<div class="col-md-12">
<div class="block-flat">
<div class="page-head">
<h3>
Bootstrap Template
</h3>
</div>
<div class="content">
<form action="/xcel" class="form-horizontal data-parsley-validate" id="fForm" method="post">
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-4 control-label">
Category</label>
<div class="col-sm-6">
<select class="select2" id="on" style="width:250px;">
<option value="Production">Production</option>
<option value="Production">Production</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Tier</label>
<div class="col-sm-6">
<select class="select2" id="tw" style="width:250px;">
<option value="Production">Production</option>
<option value="Production">Production</option>
</select>
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-4 control-label">
Name</label>
<div class="col-sm-6">
<input class="form-control" id="te" placeholder=" Name" type="text" value="" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Code</label>
<div class="col-sm-6">
<input class="form-control" id="df" name="ClientCode" placeholder=" Code" type="text" value="" />
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-4 control-label">
Model</label>
<div class="col-sm-6">
<input class="form-control" id="adg" placeholder=" Model" type="text" value="" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Center</label>
<div class="col-sm-6">
<input class="form-control" id="fd" placeholder=" Center" type="text" value="" />
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-4 control-label">
Center</label>
<div class="col-sm-6">
<input class="form-control" id="sa" placeholder=" Center" type="text" value="" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Name</label>
<div class="col-sm-6">
<input class="form-control" id="aeh" placeholder=" Name" type="text" value="" />
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-4 control-label">
CI </label>
<div class="col-sm-6">
<input class="form-control" id="he" placeholder="CI " type="text" value="" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Production </label>
<div class="col-sm-6">
<input class="form-control" id="jg" placeholder="Production IP" type="text" value="" />
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-4 control-label">
Action</label>
<div class="col-sm-6">
<select class="select2" id="lk" style="width:250px;">
<option value="Production">Production</option>
<option value="Production">Production</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Description</label>
<div class="col-sm-6">
<input class="form-control" id="ui" placeholder=" Description" type="text" value="" />
</div>
</div>
</div>
<div style='clear: both'>
</div>
<div style='clear: both'>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-4 control-label">
Physical </label>
<div class="col-sm-6">
<select class="select2" id="lj" style="width:250px;">
<option value="Production">Production</option>
<option value="Production">Production</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Read</label>
<div class="col-sm-6">
<input class="form-control" id="io" placeholder=" Read" type="text" value="" />
</div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="col-sm-4 control-label">
Write</label>
<div class="col-sm-6">
<input class="form-control" id="po" placeholder=" Write" type="text" value="" />
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label">
Test</label>
<div class="col-sm-6">
<select class="select2" id=".j" style="width:265px;">
<option value="Production">Production</option>
<option value="Production">Production</option>
</select>
</div>
</div>
</div>
<div class="form-group"> </div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
You have two .col-md-6 elements of unequal height.
The next (third) .col-md-6 will always go on the next row, starting from under the tallest of the previous siblings.
If you want to remove that space, you need to make the first .col-md-6 equal in height with the second one, by adding more padding around its inner elements (the .select2s).
UPDATE. One more thing I am noticing: in order to benefit the most from bootstrap's CSS you should stick to its' markup. You are supposed to place .col-XX-Y as direct children of .row or .row-fluid elements. Otherwise you will ask yourself why certain elements seem miss-aligned and it they will be a pain to fix at different responsive levels.
As per comments, I updated your fiddle.
In order to make the two columns equal I made the select2s equal in height as the bootstrap inputs:
.select2-container .select2-selection--single {
height: 34px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 34px;
}
.select2-container {
width: 100% !important;
}
Please take note I also removed some inline styling from your html, it's not only the CSS.

Multiple Bootstrap modals on the same page

I am working on http://steam-to-rent.ch/mietdampfanlagen.html. As you can see I am using Bootstrap collapse and when you click on the "Anfrage" button it's displaying a Bootstrap's Modal. The problem is that when you click on the second "modal button" (Anfrage) and then you close that modal the background overlay color remains and I can't interact with the page. How can I solve it?
This is the code
<button type="button" class="btn btn-primary special"
style="background: #fadf3e; border: 2px solid #000; color: #000; margin-bottom: 20px; margin-top: -10px; width: 100%;"
data-toggle="modal"
data-target=".bs-example-modal-sm">Anfrage</button>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<h4 style="color: #000;">Mietdampfanlage 21 kg/h 10 bar</h3>
<div class="col-sm-12 form">
<form class="form-modal" role="form" method="post" action="index.php">
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-12">
<input type="text" class="form-control" id="name" name="name" placeholder="Vorname, Name" value="">
</div>
</div>
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-12 ">
<input type="text" class="form-control" id="name" name="firma" placeholder="Firma" value="">
</div>
</div>
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-12 ">
<input type="email" class="form-control" id="email" name="email" placeholder="E-Mail" value="">
</div>
</div>
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-12">
<input type="text" class="form-control" id="name" name="telefon" placeholder="Telefon" value="">
</div>
</div>
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-12">
<input type="text" class="form-control" id="name" name="zeit" placeholder="Zeitraum" value="">
</div>
</div>
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-12">
<textarea class="form-control" rows="4" name="message" placeholder="Nachricht"></textarea>
</div>
</div>
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-12">
<input id="submit" name="submit" type="submit" value="Send" class="btn btn-primary">
</div>
</div>
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-10 col-sm-offset-2">
<! Will be used to display an alert to the user>
</div>
</div>
</form></div>
</div>
</div>
</div>
Edit:
<button id="modal_1" type="button" class="btn btn-primary special" style="background: #fadf3e; border: 2px solid #000; color: #000; margin-bottom: 20px; margin-top: -10px; width: 100%;" data-toggle="modal" data-target=".bs-example-modal-sm">Anfrage</button>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="row">
<div class="col-sm-12 form">
<div class="modal-header">
<h4 style="color: #000;">Mietdampfanlage 21 kg/h 10 bar</h4>
</div>
<form class="form-modal" role="form" method="post" action="index.php">
<div class="col-sm-12">
<div class="form-group">
<input type="text" class="form-control" id="name" name="name" placeholder="Vorname, Name" value="">
</div>
</div>
<div class="col-sm-12">
<div class="form-group">
<input type="text" class="form-control" id="name" name="firma" placeholder="Firma" value="">
</div>
</div>
<div class="col-sm-12 ">
<div class="form-group">
<input type="email" class="form-control" id="email" name="email" placeholder="E-Mail" value="">
</div>
</div>
<div class="col-sm-12 ">
<div class="form-group">
<input type="text" class="form-control" id="name" name="telefon" placeholder="Telefon" value="">
</div>
</div>
<div class="col-sm-12 ">
<div class="form-group">
<input type="text" class="form-control" id="name" name="zeit" placeholder="Zeitraum" value="">
</div>
</div>
<div class="col-sm-12 ">
<div class="form-group">
<textarea class="form-control" rows="4" name="message" placeholder="Nachricht"></textarea>
</div>
</div>
<div class="col-sm-12 ">
<div class="form-group">
<input id="submit" name="submit" type="submit" value="Send" class="btn btn-primary">
</div>
</div>
<div class="form-group" style="margin-bottom: 15px !important;">
<div class="col-sm-10 col-sm-offset-2">
<! Will be used to display an alert to the user>
</div>
</div>
</form></div>
</div>
</div>
</div>
</div>
data-backdrop="static"
data-keyboard="false"
first look and see if there is data-backdrop="Static" anywhere. That would do it. Also make sure data-keyboard is NOT false just to make sure you can interact.
Last I want you to look at the the ID's on the buttons and modals. make sure they are all different. I dont see an ID on this modal here so I would suggest something like
id="modal_1"
on the button AND the modal. Make sure it matches

Resources