target row and column with select name - css

I have a form and am having a problem trying to style it.
Here is what it looks like now:
I need it to look like this:
I need to style the first row and column for the Title and the 2nd row 3rd column for to date of birth.
I'm having trouble targeting the correct selector/element. Here is what the html looks like:
<h6 class="title">Personal Information</h6>
<div class="row">
<div class="col-3">
<select name="title"></select>
</div>
</div>
<div class="clear"></div>
<div class="row">
<div class="col-3">
<input type="text" name="firstname" value="" id="firstname"
maxlength="50" size="50" class="" placeholder="First name*"
style="background-image: url("data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0I
Ars4c6QAAAfBJREFUWAntVk1OwkAUZkoDKza4Utm61iP0AqyIDXahN2
BjwiHYGU+gizap4QDuegWN7lyCbMSlCQjU7yO0TOlAi6GwgJc0fT/fz
Pfmzet0crmD7HsFBAvQbrcrw+Gw5fu+AfOYvgylJ4TwCoVCs1ardYTr
uqfj8fgV5OUMSVVT93VdP9dAzpVvm5wJHZFbg2LQ2pEYOlZ/oiDvwNc
sFoseY4PBwMCrhaeCJyKWZU37KOJcYdi27QdhcuuBIb073BvTNL8ln4
NeeR6NRi/wxZKQcGurQs5oNhqLshzVTMBewW/LMU3TTNlO0ieTiStjY
hUIyi6DAp0xbEdgTt+LE0aCKQw24U4llsCs4ZRJrYopB6RwqnpA1YQ5
NGFZ1YQ41Z5S8IQQdP5laEBRJcD4Vj5DEsW2gE6s6g3d/YP/g+BDnT7
GNi2qCjTwGd6riBzHaaCEd3Js01vwCPIbmWBRx1nwAN/1ov+/drgFWI
lfKpVukyYihtgkXNp4mABK+1GtVr+SBhJDbBIubVw+Cd/TDgKO2DPiN
3YUo6y/nDCNEIsqTKH1en2tcwA9FKEItyDi3aIh8Gl1sRrVnSDzNFDJ
T1bAy5xpOYGn5fP5JuL95ZjMIn1ya7j5dPGfv0A5eAnpZUY3n5jXcoe
c5J67D9q+VuAPM47D3XaSeL4AAAAASUVORK5CYII=");
background-repeat: no-repeat; background-attachment:
scroll; background-size: 16px 18px;
background-position: 98% 50%; cursor: auto;">
<!--<input type="text" placeholder="First name*">-->
<div class="form_error"></div>
</div>
<div class="col-3">
<!-- <input type="text" placeholder="Last name*">-->
<input type="text" name="lastname" value="" id="lastname"
maxlength="50" size="50" placeholder="Last name*">
<div class="form_error"></div>
</div>
<div class="col-3">
<!-- <input type="text" placeholder="Last name*">-->
<input type="text" name="dob" value="" id="dob" maxlength="50"
size="50" placeholder="Date of birth (DD/MM/YYYY)*">
<div class="form_error"></div>
<!--<input type="text" placeholder="Date of birth (DD/MM/YYYY)*" class="dob">-->
</div>
</div>
<div class="clear"></div>
<div class="row">
<div class="col-3">
<input type="text" name="mobile" value="" id="mobile"
maxlength="50" size="50" placeholder="Mobile*">
<div class="form_error"></div>
<!--<input type="tel" placeholder="Mobile*">-->
</div>
<div class="col-3">
<input type="email" name="email" value="" id="email"
maxlength="50" size="50" placeholder="Email*">
<div class="form_error"></div>
<!--<input type="email" placeholder="Email*">-->
</div>
<div class="col-3">
<input type="text" name="emailconf" value="" id="emailconf"
maxlength="50" size="50" placeholder="Confirm Email*">
<div class="form_error"></div>
<!--<input type="email" placeholder="Confirm Email*">-->
</div>
</div>
<div class="clear"></div>
<div class="row">
<div class="col-1">
<input type="text" name="address1" value="" id="address1"
maxlength="50" size="50" placeholder="Address*">
<div class="form_error"></div>
<!--<input type="text" placeholder="Address*">-->
</div>
</div>
<div class="clear"></div>
<div class="row">
<div class="col-3">
<input type="text" name="suburb" value="" id="suburb"
maxlength="50" size="50" placeholder="Suburb*">
<div class="form_error"></div>
<!--<input type="text" placeholder="Suburb*">-->
</div>
<div class="col-3">
<select name="stateid">
</select>
</div>
<div class="col-3">
<input type="text" name="postcode" value="" id="postcode"
maxlength="4" size="10" placeholder="Postcode*">
<div class="form_error"></div>
</div>
</div>
Any help is greatly appreciated

to make the structure better I would say load bootstrap CSS
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
and use this markup:
<div class="container">
<div class="row">
<div class="col-md-12">
<h2 class="title">Personal Information</h2>
</div>
</div>
<div class="row">
<div class="col-md-2">
<select>
<option value="mr">Mr.</option>
<option value="mrs">Mrs.</option>
<option value="ms">Ms.</option>
</select>
</div>
<div class="col-md-4">
<input type="text" placeholder="First name">
</div>
<div class="col-md-4">
<input type="text" placeholder="Last name">
</div>
<div class="col-md-2">
<input type="date">
</div>
</div>
<div class="row">
<div class="col-md-4">
<input type="text" placeholder="Mobile">
</div>
<div class="col-md-4">
<input type="email" placeholder="Email">
</div>
<div class="col-md-4">
<input type="email" placeholder="Confirm Email">
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="text" placeholder="Address">
</div>
</div>
<div class="row">
<div class="col-md-4">
<input type="text" placeholder="Suburb">
</div>
<div class="col-md-4">
<select>
<option value="mr">NSW</option>
</select>
</div>
<div class="col-md-4">
<input type="text" placeholder="Post Code">
</div>
</div>
</div>
and you can customize the look of the form fields, just put this code after you load the Bootstrap
input, select { width:100%; padding:14px; margin:10px 0; border:2px solid #6aa295; }

You should use something like this. And bootstrap is responsive so You could see how it look on the expand view.
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container">
<form class="form-horizontal">
<div class="row">
<div class="col-md-12">
<h2><p class="text-center">Personal Information</p></h2>
</div>
</div>
<div class="form-group">
<div class="col-md-2">
<select class="form-control">
<option value="mr">Mr.</option>
<option value="ms">Ms.</option>
</select>
</div>
<div class="col-md-4">
<input type="text" class="form-control" id="firstname" class="form-control" placeholder="First name *">
</div>
<div class="col-md-4">
<input type="text" class="form-control" id="lastname" class="form-control" placeholder="Last name *">
</div>
<div class="col-md-2">
<div class='input-group date' id='datetimepicker2'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-4">
<input type="text" id="mobile" class="form-control" placeholder="Mobile *">
</div>
<div class="col-md-4">
<input type="email" id="email" class="form-control" placeholder="Email *">
</div>
<div class="col-md-4">
<input type="email" id="emailconf" class="form-control" placeholder="Confirm Email *">
</div>
</div>
<div class="form-group">
<div class="col-md-12">
<input type="text" id="address1" class="form-control" placeholder="Address *">
</div>
</div>
<div class="form-group">
<div class="col-md-4">
<input type="text" id="suburb" class="form-control" placeholder="Suburb *">
</div>
<div class="col-md-4">
<select class="form-control">
<option class="collapse" value="mr">Info</option>
</select>
</div>
<div class="col-md-4">
<input type="text" id="postcode" class="form-control" placeholder="Post Code *">
</div>
</div>
</form>
</div>

Related

Why does card overflow from parent col

My Form elements are not fitting in correctly and the alignment is
distorted.
.h-100 has been used since the blue back ground is my navigation and I want it to fill the entire height available in the screen.
I would prefer to accept an answer which can explain why my snippet does not work.
Plunker here
HTML
<div class="container-fluid h-100">
<div class="row h-100">
<div class="col-2 blue">
</div>
<div class="col-10">
<div class="card h-100">
<div class="card-body">
<form>
<div class="form-group">
<label for="Random">Random 1</label>
<input type="text" class="form-control" id="random1" aria-describedby="emailHelp" placeholder="Enter name">
</div>
<div class="form-group">
<label for="Random">Random 2</label>
<input type="text" class="form-control" id="random2" aria-describedby="emailHelp" placeholder="Enter name">
</div>
<div class="form-group">
<label for="Random">Random 3</label>
<input type="text" class="form-control" id="random3" placeholder="Enter Random">
</div>
<div class="form-group">
<label for="Random">Random 4</label>
<input type="text" class="form-control" id="random4" aria-describedby="employeeCodeHelp" placeholder="Enter random random">
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="isActive">
<label class="form-check-label" for="isActive">Is Active</label>
</div>
<div class="form-group">
<label for="Random">Random 5</label>
<input type="text" class="form-control" id="random5" placeholder="Enter Random Random">
</div>
<div class="form-group">
<label for="phoneNumber">Random 6</label>
<input type="number" class="form-control" id="random6" placeholder="Enter phone number">
</div>
<div class="form-group">
<label for="emailId">Email</label>
<input type="number" class="form-control" id="emailId" placeholder="Enter email">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
</div>
CSS
.blue {
background-color:blue;
}
html,body {
height: 100%;
}
Screen shot
remove .h-100 class from .container and from .row as its height should be auto instead of 100% , answer is as per what i understand , that your card is going out of your .col right?
if you want to give blue shape than here is the code :
<div class="row">
<div class="col-2 blue">
</div>
<div class="col-10">
<div class="card h-100">
<div class="card-body">
<form>
<div class="form-group">
<label for="Random">Random 1</label>
<input type="text" class="form-control" id="random1" aria-describedby="emailHelp" placeholder="Enter name">
</div>
<div class="form-group">
<label for="Random">Random 2</label>
<input type="text" class="form-control" id="random2" aria-describedby="emailHelp" placeholder="Enter name">
</div>
<div class="form-group">
<label for="Random">Random 3</label>
<input type="text" class="form-control" id="random3" placeholder="Enter Random">
</div>
<div class="form-group">
<label for="Random">Random 4</label>
<input type="text" class="form-control" id="random4" aria-describedby="employeeCodeHelp" placeholder="Enter random random">
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="isActive">
<label class="form-check-label" for="isActive">Is Active</label>
</div>
<div class="form-group">
<label for="Random">Random 5</label>
<input type="text" class="form-control" id="random5" placeholder="Enter Random Random">
</div>
<div class="form-group">
<label for="phoneNumber">Random 6</label>
<input type="number" class="form-control" id="random6" placeholder="Enter phone number">
</div>
<div class="form-group">
<label for="emailId">Email</label>
<input type="number" class="form-control" id="emailId" placeholder="Enter email">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
.blue{
min-height: 100px //the height you want to give
}

vertically align textbox using bootstrap classes

I've made 5 rows using bootstrap, they got placed neatly, but there is a small issue. The rows are getting in contact without leaving any gap. I should not use , this will bring a big gap, and the textboxes in each row should be vertically align, if there is no radio button in that row, that corresponding place should be kept empty and textbox should get aligned properly with all rows. The starting textbox in all rows should start at the same place where the first row textbox has started. Here is my code
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="form-inline">
<div class="radio" style="width: 100px;">
<label><input type="radio" name="optradio">Option
1</label>
</div>
<input type="text" class="form-control" />
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-inline">
<div class="radio" style="width: 100px;">
<label><input type="radio" name="optradio">Option
1</label>
</div>
<input type="text" class="form-control" /> <input type="text"
class="form-control" />
<div class="form-group">
<label for="sel1">Select list:</label> <select
class="form-control" id="sel1">
<option>Apple</option>
<option>Mango</option>
<option>Orange</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-inline">
<input type="text" class="form-control" /> <input type="text"
class="form-control" /> <input type="text" class="form-control" />
<input type="text" class="form-control" /> <input type="text"
class="form-control" />
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-inline">
<div class="radio" style="width: 100px;">
<label><input type="radio" name="optradio">Option
1</label>
</div>
<input type="text" class="form-control" /> <input type="text"
class="form-control" />
<div class="form-group">
<label for="sel1">Select list:</label> <select
class="form-control" id="sel1">
<option>Apple</option>
<option>Mango</option>
<option>Orange</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-inline">
<input type="text" class="form-control" /> <input type="text"
class="form-control" /> <input type="text" class="form-control" />
<input type="text" class="form-control" /> <input type="text"
class="form-control" />
</div>
</div>
</div>
</div>
Please check in browser not in fiddle because it changes alignments .
<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>
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="form-inline form-group">
<div class="radio" style="width:95px;" >
<label><input type="radio" name="optradio" style="vertical-align:middle;"> Option
1</label>
</div>
<input type="text" class="form-control" />
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-inline form-group">
<div class="radio" style="width:95px;" >
<label><input type="radio" name="optradio">Option
1</label>
</div>
<input type="text" class="form-control" /> <input type="text"
class="form-control" />
<div class="form-group">
<label for="sel1">Select list:</label> <select
class="form-control" id="sel1">
<option>Apple</option>
<option>Mango</option>
<option>Orange</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-offset-1">
<div class="form-inline form-group">
<input type="text" class="form-control" /> <input type="text"
class="form-control" /> <input type="text" class="form-control" />
<input type="text" class="form-control" /> <input type="text"
class="form-control" />
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-inline form-group">
<div class="radio" style="width:95px;">
<label><input type="radio" name="optradio">Option
1</label>
</div>
<input type="text" class="form-control" /> <input type="text"
class="form-control" />
<div class="form-group">
<label for="sel1">Select list:</label> <select
class="form-control" id="sel1">
<option>Apple</option>
<option>Mango</option>
<option>Orange</option>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12 col-md-offset-1">
<div class="form-inline form-group">
<input type="text" class="form-control" /> <input type="text"
class="form-control" /> <input type="text" class="form-control" />
<input type="text" class="form-control" /> <input type="text"
class="form-control" />
</div>
</div>
</div>
</div>
Here is JSFIDDLE

How to have 3 inputs on the same row

I am using bootstrap in an attempt to create a form. Part of the form involves inputting social media links (FB, Linkedin & Twitter). I would like all of these inputs to be within one row - how can I do this? Thanks in advance.
http://jsfiddle.net/qn4mxqrq/1/
<HTML>
<div class="form-group col-xs-12 col-sm-6 col-md-6 col-lg-2" id="upload_photo">
<input type="image" src="img/square_face.png" alt="Submit" >
<br>
<br>
</div>
<div class="form-group col-xs-12 col-sm-6 col-md-6 col-lg-6" id="upload_basic_info">
<div class="form-group">
<label for="firstname">Name</label>
<input type="text" class="form-control input" maxlength="50" data-error="Please fill out this field." name="name" id="name" placeholder="Name" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="lastname">Their Email Address </label>
<input type="text" class="form-control input" maxlength="50" data-error="Please fill out this field." name="email" id="email" placeholder="Their Email Address" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="country">Their Country</label>
<select class="form-control input" data-error="Please fill out this field." name="country" id="country" required onchange="App.populate_option('Get_States', 'state', true, true, 'Create', $(this).val());">
<option value="" disabled selected="selected">Their Country</option>
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="country">Their State/Region</label>
<select class="form-control input" data-error="Please fill out this field." name="state" id="state" required disabled="disabled">
<option value="" disabled selected="selected">Their State/Region</option>
</select>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group col-xs-12" id="upload_socialmedia"><!--Start Social Media inputs -->
<div class="form-group"><!--Start Facebook Input -->
<label class="col-lg-2 control-label" name="facebook"></label>
<div class="col-lg-10">
<input id="upload_fb" name="facebook" id="facebook" placeholder="Facebook URL" type="url">
</div>
</div><!--End Facebook Input -->
<div class="form-group"><!--Start Linkedin Input -->
<label class="col-lg-2 control-label" name="linkedin"></label>
<div class="col-lg-10">
<input id="upload_linkedin" name="linkedin" id="linkedin" placeholder="Linkedin URL" type="url">
</div>
</div><!--End Linkedin Input -->
<div class="form-group"><!--Start Twitter Input -->
<label class="col-lg-2 control-label" name="twitter"><img src=></label>
<div class="col-lg-10">
<input id="upload_twitter" name="twitter" id="twitter" placeholder="Twitter URL" type="url">
</div>
</div><!--End Twitter Input -->
</div> <!--End Social Media inputs -->
<CSS>
.container_upload{
width:1000px;
margin-left:60px;
}
#upload_photo{
height:150px;
width:300px;
}
.help-block {
display: block;
margin-top: 5px;
margin-bottom: 10px;
color: #737373
}
#upload_basic_info{
height:275px;
}
#upload_fb{
background: url(img/fb.png) no-repeat scroll 7px 7px;
padding-left:30px;
}
</CSS>
You can simply place those three inputs in an single row and apply col-*-4 to each.
See working example Snippet.
body {
padding-top: 50px;
}
#upload_culprit_photo {
margin-bottom: 20px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-6">
<input type="image" src="http://placehold.it/300x150" class="img-responsive center-block" id="upload_culprit_photo" />
</div>
<div class="col-xs-12 col-sm-6" id="upload_basic_info">
<div class="form-group">
<label for="firstname">Name</label>
<input type="text" class="form-control" maxlength="50" data-error="Please fill out this field." name="name" id="name" placeholder="Name" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="lastname">Their Email Address</label>
<input type="text" class="form-control" maxlength="50" data-error="Please fill out this field." name="email" id="email" placeholder="Their Email Address" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="country">Their Country</label>
<select class="form-control" data-error="Please fill out this field." name="country" id="country" required onchange="App.populate_option('Get_States', 'state', true, true, 'Create', $(this).val());">
<option value="" disabled selected="selected">Their Country</option>
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="country">Their State/Region</label>
<select class="form-control" data-error="Please fill out this field." name="state" id="state" required disabled="disabled">
<option value="" disabled selected="selected">Their State/Region</option>
</select>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-4">
<div class="form-group">
<label name="facebook">Facebook</label>
<input id="upload_fb" class="form-control" name="facebook" id="facebook" placeholder="Facebook URL" type="url">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label name="linkedin">LinkedIn</label>
<input id="upload_linkedin" class="form-control" name="linkedin" id="linkedin" placeholder="Linkedin URL" type="url">
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label name="twitter">Twitter</label>
<input id="upload_twitter" class="form-control" name="twitter" id="twitter" placeholder="Twitter URL" type="url">
</div>
</div>
</div>
</div>
I found a workaround, you can actually do it like this:
<div class="form-group col-xs-12" id="upload_socialmedia"><!--Start Social Media inputs -->
<!-- EDIT THIS CLASS (and the two others) -->
<div class="form-group col-xs-4"><!--Start Facebook Input -->
<label class="col-lg-2 control-label" name="facebook"></label>
<div class="col-lg-10">
<input id="upload_fb" name="facebook" id="facebook" placeholder="Facebook URL" type="url">
</div>
</div><!--End Facebook Input -->
<div class="form-group col-xs-4"><!--Start Linkedin Input -->
<label class="col-lg-2 control-label" name="linkedin"></label>
<div class="col-lg-10">
<input id="upload_linkedin" name="linkedin" id="linkedin" placeholder="Linkedin URL" type="url">
</div>
</div><!--End Linkedin Input -->
<div class="form-group col-xs-4"><!--Start Twitter Input -->
<label class="col-lg-2 control-label" name="twitter"><img src=""></label>
<div class="col-lg-10">
<input id="upload_twitter" name="twitter" id="twitter" placeholder="Twitter URL" type="url">
</div>
</div><!--End Twitter Input -->
</div> <!--End Social Media inputs -->
EDIT: Sorry, it looks like I missread the original problem. So #Manuel Choucino's answer seems to be the good one.
Just use left floats.
.class{float:left;}
If I have understood what you want correctly:
http://jsfiddle.net/qn4mxqrq/4/
This is an edited version of your code.
When I look at your code, there is one Class name that control all of group. form-group.
in your CSS just create rules for that socialForm.
.socialForm{
float: left;
}
Here adding bootstrap classes like col-lg,col-md,col-sm,col-xs every class will work different devices.example:col-lg its works in large size desktop(1920 *1080 resolution ),col-md works in medium size desktop(1366*768 resolution )
,col-sm works in tablets and col-xs works in mobiles
Hope my answer will work in all devices.
body {
padding-top: 50px;
}
#upload_culprit_photo {
margin-bottom: 20px;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 ">
<input type="image" src="http://placehold.it/300x150" class="img-responsive center-block" id="upload_culprit_photo" />
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12 " id="upload_basic_info">
<div class="form-group">
<label for="firstname">Name</label>
<input type="text" class="form-control" maxlength="50" data-error="Please fill out this field." name="name" id="name" placeholder="Name" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="lastname">Their Email Address</label>
<input type="text" class="form-control" maxlength="50" data-error="Please fill out this field." name="email" id="email" placeholder="Their Email Address" required>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="country">Their Country</label>
<select class="form-control" data-error="Please fill out this field." name="country" id="country" required onchange="App.populate_option('Get_States', 'state', true, true, 'Create', $(this).val());">
<option value="" disabled selected="selected">Their Country</option>
</select>
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
<label for="country">Their State/Region</label>
<select class="form-control" data-error="Please fill out this field." name="state" id="state" required disabled="disabled">
<option value="" disabled selected="selected">Their State/Region</option>
</select>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
<div class="form-group">
<label name="facebook">Facebook</label>
<input id="upload_fb" class="form-control" name="facebook" id="facebook" placeholder="Facebook URL" type="url">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
<div class="form-group">
<label name="linkedin">LinkedIn</label>
<input id="upload_linkedin" class="form-control" name="linkedin" id="linkedin" placeholder="Linkedin URL" type="url">
</div>
</div>
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
<div class="form-group">
<label name="twitter">Twitter</label>
<input id="upload_twitter" class="form-control" name="twitter" id="twitter" placeholder="Twitter URL" type="url">
</div>
</div>
</div>
</div>

Bootstrap "form-horizontal" and label

I have troubles with creating a "form-horizontal" with bootstrap.
http://jsfiddle.net/frauger/jo0b6yod/
As you can see in the jsfiddle the label "date of birth" is not correctly aligned above the "date of birth select"
<form class="form-horizontal">
<div class="form-group">
<label for="name" class="col-xs-2 control-label">Name</label>
<div class="col-xs-10">
<input type="text" class="form-control col-sm-10" name="name" placeholder="name"/>
</div>
</div>
<div class="form-group">
<label for="birthday" class="col-xs-3 col-sm-2 control-label">Birthday</label>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="year"/>
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="month"/>
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="day"/>
</div>
</div>
Thanks
Wrap all of your existing select divs in a new container div that has the form-group class.
<div class="form-group">
<div class="col-xs-4">
<select type="text" class="form-control" id="field-day" required>
<option>DD</option>
</select>
</div>
<div class="col-xs-4">
<select type="text" class="form-control" id="field-month" required>
<option>MM</option>
</select>
</div>
<div class="col-xs-4">
<select type="text" class="form-control" id="field-year" required>
<option>YYY</option>
</select>
</div>
</div>
working fiddle:
http://jsfiddle.net/jo0b6yod/2/
Include the label within div tag, that should make the label within a block level, and takes of 100% of its parent.
ex:
<div class="form-group">
<div><label for="birthday" class="col-xs-3 col-sm-2 control-label">Birthday</label></div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="year"/>
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="month"/>
</div>
<div class="col-xs-3">
<input type="text" class="form-control" placeholder="day"/>
</div>
</div>

How to properly align field without label on bootstrap form

I have
<form action="#" method="post" class="well">
<fieldset>
<div class="control-group">
<label class="control-label" for="FirstName">Name</label>
<div class="controls row-fluid">
<div class="span2 row">
<input class="span12" id="FirstName" name="FirstName" placeholder="Firstname" type="text" value=""/>
</div>
<div class="span2 row">
<input class="span12" id="MiddleName" name="MiddleName" placeholder="Middlename" type="text" value=""/>
</div>
<div class="span2 row">
<input class="span12" id="LastName" name="LastName" placeholder="Lastname" type="text" value=""/>
</div>
</div>
</div>
</fieldset>
</form>
jsfiddle: http://jsfiddle.net/bWGfb/
I want to add label for Last Name, so I want to have labels for First and Last Name only. How is it possible with bootstrap?
UPDATE:
I can make something like that:
<div class="row-fluid">
<div class="span12">
<div class="span4">
<label>First Name</label>
<input type="text" class="span12" placeholder="First Name">
</div>
<div class="span4" style="margin-top: 25px;">
// field without label
<input type="text" class="span12" placeholder="Last Name">
</div>
<div class="span4 ">
<label>First Name</label>
<input type="text" class="span12" placeholder="Last Name">
</div>
</div>
</div>
​
http://jsfiddle.net/bWGfb/1/
but it adds extra margin style.
Something like this:
<form action="#" method="post" class="well">
<fieldset>
<div class="control-group">
<div class="row-fluid">
<div class="span3">
<label for="FirstName">First name</label>
<input class="span12" id="FirstName" name="FirstName" placeholder="Firstname" type="text" value=""/>
</div>
<div class="span3">
<label for="MiddleName"> </label>
<input class="span12" id="MiddleName" name="MiddleName" placeholder="Middlename" type="text" value=""/>
</div>
<div class="span3">
<label for="LastName">Last name</label>
<input class="span12" id="LastName" name="LastName" placeholder="Lastname" type="text" value=""/>
</div>
</div>
</div>
</fieldset>
</form>
Just override the label style in bootstrap.css (line 946) in your own CSS
It has 5px bottom margin, just set it to what you need, but tbh a little spacing is good ;)

Resources