How to center input boxes (bootstrap form) - css

<div class="container-full">
<div class="jumbotron text-center" style="background-color:#fff" ng-show="registrationForm">
<p class="genericText">Fill out the following information to create your profile.</p>
<!-- FORM -->
<!-- pass in the variable if our form is valid or invalid -->
<form name="goalsForm" ng-submit="submitForm(goalsForm.$valid)">
<div style='width: 100%; display: inline-block;'>
<div class="form-group col-xs-4">
<label for="exampleInputEmail1">Create Password</label>
<input type="Text" class="form-control" id="inputGoal" placeholder="Enter a password" ng-model="goal">
</div>
<div class="form-group col-xs-4">
<label for="exampleInputEmail1">Confirm Password</label>
<input type="Text" class="form-control" id="inputGoal" placeholder="Confirm your password" ng-model="goal">
</div>
</div>
<button type="submit" class="btn btn-default">Complete</button>
</form>
</div>
</div> <!-- /container full -->
The above is my code for my form, I am using the full width bootstrap layout within Angular.js. Here is a screen of the output.
The two input boxes are within a parent div that is 100% wide, I am trying to center the two input boxes so that it does not lose it's responsiveness when resized.
I have tried
.text-center
margin: auto
without any success.
How can I do this?
Thanks.

Related

bootstrap container contents in the left side of the screen?

I am using bootstrap and I have a container with a login form.
However, I want to align this form to the left side of the page. However, using float left makes it look ugly and also makes the form input smaller, as you can see here:
http://codepen.io/anon/pen/xZGOjR
<div class="container">
<div class="form-container">
<form class="form-horizontal" name="form" role="form" >
<fieldset>
<div class="form-group">
<div class="btn-icon-lined btn-icon-round btn-icon-sm btn-default-light">
</div>
<input type="email" class="form-control input-lg input-round text-center" placeholder="Email" ng-model="user.email" name="email" ng-required autofocus>
</div>
<div class="form-group">
<div class="btn-icon-lined btn-icon-round btn-icon-sm btn-default-light">
</div>
<input type="password" class="form-control input-lg input-round text-center" placeholder="Password">
</div>
<div class="form-group">
<button type="submit" class="btn btn-primary btn-lg btn-round btn-block text-center">Log in</button>
</div>
</fieldset>
</form>
</div>
</div>
How can I make it so the form input is to the left side without looking ugly?
To do it the bootstrap way. You could add a column width to the form <div class="form-container text-center col-xs-3">
Here is your original example tidied up a bit http://codepen.io/anon/pen/XXbKvN
Bootstrap uses a 12 column grid system so that everything is nicely laid out on the page. For more info have a look here http://getbootstrap.com/css/#grid-options
You can use width: 350px; to the .form-container class.
It can better, if you can upload your design. screenshot.

I am making a sign in page using bootstrap. How do I center it?

I am doing a school project and I need to make a sign in page. I have found this code, but it is not showing up in the center of the page. It is showing up on the left side of the page. Well, the first part is showing up on the left side and the second part is showing up on the right side. I need the right side below the left side after it is centered.
Here is my code:
<div class="container">
<div class="row">
<!-- left half of the page -->
<div class="col-xs-6">
<form class="form-signin" method="post" action="login.php">
<h2 class="form-signin-heading">Please sign in</h2>
<div class="form-group">
<label for="inputEmail">Email address</label>
<input type="text" name="emailaddress" id="inputEmail" class="form-control" placeholder="Email address" value="" required autofocus>
</div>
<div class="form-group">
<label for="inputPassword">Password</label>
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required>
</div>
<button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
</div>
<!-- right half of the page -->
<div class="col-xs-6">
<h3>Not a member yet?</h3>
Join our club, it's the best!
</div>
</div>
</div>
What am I doing wrong? Should I add more code? Why is it showing up on the left side of my screen?
In the class part of the div element you want to center, write "centered".
For example, if you want to center the row, change
<div class="row">
to
<div class="row centered">
This is usually a preset style class in Bootstrap. If this doesn't work, you can also use a style setting:
<div class="row" style="text-align: center">
Simple solution:
<center>[code]</center>
Also <div class="centered"> is fine.

Bootstrap 3: Form styles failing

Here is my jsFiddle with full code example.
I would like:
The entire "page content" container (that is, the <h1> that starts "Sign in to..." as well as the entire <form> element) to be centered in the screen; and
The "Need help?" link needs to be left aligned, aligning with the submit button's left side
I am trying to style center the container via text-center. I am trying to align the link via text-left. Neither are working:
<div class="container">
<div class="row">
<div class="col-md-8 text-center">
<h1 class="strong-primary">Sign in to continue to Audit<b>Cloud</b>.</h1>
</div>
<div class="col-md-4 text-center">
<form role="form">
<div class="form-group">
<input type="email" class="form-control" id="signin-email" placeholder="Your email">
</div>
<div class="form-group">
<input type="password" class="form-control" id="signin-password" placeholder="Password">
</div>
<button type="submit" class="btn form-control btn-lg btn-success">Sign in</button>
<div class="form-group">Need help?</div>
</form>
</div>
</div>
</div>
Any ideas?
You need to apply text-align:left; to the containing <div>. Instead of class="text-left, use style="text-align:left;. I put those changes into your fiddle:
http://jsfiddle.net/fjL4f2ew/1/

bootstrap: form-control size doesnt change based on parent div col size

I am trying to use increase the size of my text box but changing col-md-* value doesn't seem to affect the child input form-control textbox.
Example:
<form id="myForm">
<div class="row">
<div class="col-md-2">
Name:
</div>
<div class="col-md-8">
<input name="Name" type="text" placeholder="Enter a name ..." class="form-control" required="required" />
</div>
</div>
</form>
In above code the text input size doesn't increase to what I think should be larger if I used col-md-8. The text box size is same whether I use col-md-4 or col-md-6 also. Is it because form-control class in bootstrap defines a size? If so how can this be fixed?
Try this its work for me
<div class="row">
<form id="myForm">
<div class="col-md-2">
Name:
</div>
<div class="col-md-8">
<input name="Name" type="text" placeholder="Enter a name ..." class="form-control" required="required" />
</div>
</form>
</div>

use bootstrap to affix button on right of container

I am trying to use affix of bootstrap 3.
Its working fine but i need to do the button affix right to container not to window.
The problem i am facing is when i Ctrl-- to reduce screen size button get stick on right of window.(facing problem on large screen)
How can i stick button to right of container.so when screen size get large it display right to container.
Here is link: Fiddle link
.save-btn .affix {
top: 100px;
right: 0px;
}
.container {
border: 1px solid #ccc;
}
<div class="container">
<div class="row">
<div class="col-md-12">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control" id="exampleInputEmail1" placeholder="Enter email">
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
</div>
<div class="form-group">
<label for="exampleInputFile">File input</label>
<input type="file" id="exampleInputFile">
<p class="help-block">Example block-level help text here.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox"> Check me out
</label>
</div>
<div class="save-btn">
<button name="submit" type="submit" value="Save" class="btn btn-orange btn-lg affix" data-spy="affix" data-offset-top="0">Save </button>
</div>
</form>
</div>
</div>
</div>
The jsfiddle is using BS 2.x, but your markup is for Bootstrap 3.
I created a Bootply (which includes BS 3 automatically): http://www.bootply.com/95296
I think you want to use pull-right and not affix to pull the button to the right.

Resources