How to give a space between model label and model text field - html

I am trying to give a space between label and text field using twitter bootstarp.
bellow is the screenshot
I want to give a space between
User Name label space User Name text field
same withe other field.
how can I do that
This is my code
<div class="modal fade" id=addNewUser tabindex="-1" role="dialog" aria-labelledby="helpModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">New User</h4>
</div>
<div class="modal-body">
<form class="AddUser" role="form">
<div class="input-group col-md-8"> <span class="input-group-addon ">User Name</span>
<input class="form-control" type="text" class="form-control" placeholder="User Name" />
</div>
<div class="input-group col-md-8"> <span class="input-group-addon">Password </span>
<input class="form-control" type="text" class="form-control" placeholder="Password" />
</div>
<div class="input-group col-md-8"> <span class="input-group-addon">Roles</span>
<div class="checkbox">
<label>
<input type="checkbox">Admin</label>
</div>
</div>
<div class="input-group col-md-8"> <span class="input-group-addon">Status</span>
<div class="radio">
<label>
<input type="radio">Active</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default blue-btn">Add User</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
</div>
When I am applying this
.input-group-addon { display: inline-block; margin-right: 12px; width: 80px; }
Css Which I am using
.input-group-addon {
min-width:100px;
text-align:left;
}
.modal-dialog {
height: 80%;
padding-top:10%;
}
.modal-content {
height: 60% !important;
overflow:visible;
}
.modal-body {
height: 70%;
overflow: auto;
}
.modal-footer {
position:absolute;
bottom:0;
left:0;
right:0;
}

Insert &nbsp to the end of your captions
&nbsp is the entity used to represent a non-breaking space. It is essentially a standard space, the primary difference being that a browser should not break (or wrap) a line of text at the point that this occupies.
OR using CSS..
Provide your stylesheet with a class for form input elements making use of the margin: style.
In this case you would use a style on the class="input-group-addon" field.
.input-group-addon {
margin-right: 1em;
}

maybe try something like:
.input-group-addon { display: inline-block; margin-right: 12px; width: 80px; }

Related

how can i disble the text part of input type="file"

I'm creating a form but I don't want input type"file" to shown, I mean it should work but Choose File button and No file chosen part shouldn't be shown.
here's my HTML code
<div class="row">
<div class="form-group col-md-12">
<label>File upload</label>
<div class="input-group col-xs-12 ">
<input type="file" id="files" name="files[]" class="form-control btn btn-primary mb-xl-4" multiple>
</div>
</div>
</div>
here's how it's shown
how code works
It's possible to hide to the input element and make the surrounding element clickable, so it triggers the 'Choose file' popup from the browser. Therefore you should add an id or exclusive class to the parent element.
<div class="row">
<div class="form-group col-md-12">
<label>File upload</label>
<div class="input-group col-xs-12" id="files">
<input type="file" name="files[]" class="form-control btn btn-primary mb-xl-4" multiple>
</div>
</div>
</div>
#files {
width: 100px;
height: 100px;
display: inline-block;
overflow: hidden;
cursor: pointer;
}
#files input=[type="file"] {
height: 100%;
width: 100;
opacity: 0;
cursor: pointer;
}
You're also able to make a button with the label in this way if you move the files id to the form-group div.
Try this
<div class="row">
<div class="form-group col-md-12">
<label>File upload</label>
<div class="input-group col-xs-12 ">
<input type="file" id="files" name="files[]" style="display:none" class="form-control btn btn-primary mb-xl-4" multiple>
<button onclick="document.getElementById('files').click()">Choose Files</button>
</div>
</div>
</div>

bootstrap modal form label/textbox size empty spaces issue

At the start, the first label line has empty spaces in front of it, causing it to be pushed forward. Hence, I adjusted it using style in the HTML page, why and how do I resolve this issue?
I am unable to change the textbox size of the form as well. I would like to change the textbox size in the Food div container, both of the text boxes to be aligned in one straight line and the word "To" in between the boxes, without affecting the whole form alignment.
#output_image{
border-style: solid;
float:left;
}
.inputfile {
width: 0.1px;
height: 0.1px;
opacity: 0;
overflow: hidden;
position: relative;
z-index: -1;
}
.label{
opacity: 0;
}
.inputfile + label {
position: relative;
font-size: 2.5em;
display: inline-block;
color: black;
text-align: center;
padding: 2px 2px;
text-decoration: none;
float:left;
}
.inputfile:focus + label,
.inputfile + label:hover {
}
.inputfile + label {
cursor: pointer;
}
.iconplus{
position: relative;
}
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bd-example-modal-lg">
Instagram Like
</button>
<!-- Modal -->
<div class="modal fade bd-example-modal-lg" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl modal-dialog-right" role="document">
<div class="modal-content">
<div class="modal-header ">
<h2 style="font-family: Lato; font-size:29pt; font-weight:bold;" class="modal-title " id="exampleModalLongTitle">Instagram</h2>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body form-horizontal">
<form class="form-horizontal" id="step2">
<img id="output_image" height=270px width=270px>
<input class="inputfile" type="file" id="getFile" accept="image/*" onchange="preview_image(event)">
<label for="getFile" <i class="fa fa-plus-circle iconplus" style = "position:relative; top:23.1rem; right:3.45rem;"></i> </label>
<div class="form-group row align-items-center justify-content-center">
<label style="font-family:Lato; font-size:20pt; font-weight:normal; margin-right:6.8rem;" for="name" class="col-sm-4 control-label col text-left">Name:</label>
<div class="col-sm-5 ">
<input id="name" style= "margin-right:10rem;" class="form-control input-lg row align-items-left justify-content-left" type="text" placeholder="Enter Name" />
</div>
</div>
<div class="form-group row align-items-center justify-content-center">
<label style="font-family:Lato; font-size:20pt; font-weight:normal;" for="name" class="col-sm-4 control-label col text-left">Email:</label>
<div class="col-sm-5 ">
<input id="name" class="form-control input-lg row align-items-left justify-content-left" type="text" placeholder="Enter Your Email Address" />
</div>
</div>
<div class="form-group row align-items-center justify-content-center">
<label style="font-family:Lato; font-size:20pt; font-weight:normal;" for="name" class="col-sm-2 control-label col text-left " >Food Date:</label>
<div class="col-sm-3">
<input id="name" class="form-control input-lg row align-items-center justify-content-left" type="password" placeholder="Start Food" />
</div>
<label style="font-family:Lato; font-size:20pt; font-weight:normal;" for="name" class="col-sm-2 control-label col text-left " >To</label>
<div class="col-sm-3">
<input id="name" class="form-control input-lg row align-items-center justify-content-left" type="password" placeholder="End Food" />
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary">Create</button>
</div>
</div>
</div>
</div>
</div>

Aligning modal content box to center of any screen

Hi i have created login form and need to display that box to center of any screens.Gap should be equal on all the sides in any of the screens.Tried with postion:absolute display flexbut not working.
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-heading">
<h2 class="text-center"><img src="images/logo.png"></h2>
</div>
<hr />
<div class="modal-body">
<form action="" role="form">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<span class="glyphicon glyphicon-user"></span>
</span>
<input type="text" class="form-control" placeholder="User Name" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<span class="glyphicon glyphicon-lock"></span>
</span>
<input type="password" class="form-control" placeholder="Password" />
</div>
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-success btn-lg">Login</button>
forget Password
</div>
</form>
</div>
</div>
</div>
Style.css
.modal-content{
background-color: #fff;
}
.btn-link{
color:white;
}
.modal-heading h2{
color:#ffffff;
}
.modal-dialog{
position:absolute;
left:50%;
width:400px;
top:50%;
transform:translate(-50% , -50%)
}
add this and it should work!
You can making it with display block, margin auto and text align on modal-dialog
.modal-content{
background-color: #fff;
}
.btn-link{
color:white;
}
.modal-heading h2{
color:#ffffff;
}
.modal-dialog {
width:400px;
display: block;
margin: 0px auto;
text-align:center;
}
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-heading">
<h2 class="text-center"><img src="images/logo.png"></h2>
</div>
<hr />
<div class="modal-body">
<form action="" role="form">
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<span class="glyphicon glyphicon-user"></span>
</span>
<input type="text" class="form-control" placeholder="User Name" />
</div>
</div>
<div class="form-group">
<div class="input-group">
<span class="input-group-addon">
<span class="glyphicon glyphicon-lock"></span>
</span>
<input type="password" class="form-control" placeholder="Password" />
</div>
</div>
<div class="form-group text-center">
<button type="submit" class="btn btn-success btn-lg">Login</button>
forget Password
</div>
</form>
</div>
</div>
</div>

Scrollable content in the middle of a modal dialog with variable height sticky header on top and footer with position absolute at the bottom?

I have the following Bootstrap 3.x modal dialog:
<!-- Modal dialog -->
<div class="modal fade in" id="dlgUsr" tabindex="-1" role="dialog" aria-labelledby="dlgTitle">
<div class="modal-dialog modal-lg modal-dlg-full-haw" role="document">
<div class="modal-content" style="height: 100%;">
<div class="modal-dlg-drag-bar"></div>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="dlgTitle" class="title">Title</h3>
</div>
<div class="modal-body">
<? require 'some_server_generated_code.php'; ?>
</div>
<div class="modal-footer">
Close
Save
</div>
</div>
</div>
</div>
The div with id modal-body contains server generated HTML code. And here is the CSS:
.modal-dlg-full-haw .h1,
.modal-dlg-full-haw .h2,
.modal-dlg-full-haw .h3,
.modal-dlg-full-haw h1,
.modal-dlg-full-haw h2,
.modal-dlg-full-haw h3 {
margin-top: 0;
margin-bottom: 10px;
}
.modal-dlg-full-haw {
display: block;
position: absolute;
height: auto;
width: auto;
bottom: 0;
top: 0;
left:0;
right:0;
margin: 10px;
}
.modal-dlg-full-haw .modal-content {
height: 100%;
width: 100%;
margin-bottom: 10px;
}
.modal-dlg-full-haw .modal-header {
padding: 0 15px 0 15px;
}
.modal-dlg-full-haw .modal-footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
.modal-body .tab-content {
padding-top: 10px;
}
.modal-content .modal-dlg-drag-bar {
height: 15px;
cursor: -webkit-grab; cursor: -moz-grab;
}
.modal-content .modal-dlg-drag-bar:active {
cursor: -webkit-grabbing; cursor: -moz-grabbing;
}
Now, here is the rendered code (with the server side part too):
<div class="modal fade in" id="dlgUsr" tabindex="-1" role="dialog" aria-labelledby="dlgTitle" style="display: block; padding-right: 15px;">
<div class="modal-dialog modal-lg modal-dlg-full-haw" role="document">
<div class="modal-content" style="height: 100%;">
<div class="modal-dlg-drag-bar"></div>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="dlgTitle" class="title">User</h3>
</div>
<div class="modal-body">
<div class="tabbable">
<form action="#" method="post" id="formUsr" class="formo">
<ul class="nav nav-tabs" id="tabUsr">
<li class="active">Tab 1</li>
<li>Tab 2</li>
<li>Tab 3</li>
<li>Tab 4</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tabGen">
<input type="hidden" id="usr_id" value="2">
<div class="">
<div class="row">
<div class="col-md-6 form-group">
<label class="control-label" for="usr_nick">Nick</label>
<input type="text" value="" id="usr_nick" class="validate[required] form-control" name="usr[nick]">
</div>
<div class="col-md-6 form-group">
<label class="control-label" for="usr_pwd">Password</label>
<input type="text" value="" id="usr_pwd" class="validate[required] form-control" name="usr[pwd]">
</div>
</div>
</div>
<div class="">
<div class="row">
<div class="col-md-6 form-group">
<label class="control-label" for="usr_last_name">Last Name</label>
<input type="text" value="" id="usr_last_name" class="form-control" name="usr[last_name]">
</div>
<div class="col-md-6 form-group">
<label class="control-label" for="usr_first_name">Name</label>
<input type="text" value="" id="usr_first_name" class="form-control" name="usr[first_name]">
</div>
</div>
</div>
<div class="">
<div class="row">
<div class="col-md-6 form-group">
<label class="control-label" for="usr_email">E-Mail</label>
<input type="text" value="" id="usr_email" class="form-control" name="usr[email]">
</div>
<div class="col-md-6 form-group">
<label class="control-label" for="usr_tel">Telephone</label>
<input type="text" value="" id="usr_tel" class="form-control" name="usr[tel]">
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
<div class="modal-footer">
Close
Edit
</div>
</div>
</div>
</div>
It looks like this:
If I resize the height of the browser's window:
You can see that the dialog's footer overlaps with the modal-body. Here is another screenshot:
How can I make that modal-body (which contains the tabs and the form with inputs) scrollable while maintaining the CSS I already have and the footer sticky at the bottom with position absolute as I have already done?

Bootstrap 3 - element won't stay in the width of the div

I am using bootstrap 3 in a small div. When I increase the window's width by dragging the window - the fields (username and password input fields) that are supposed to stay in the interior of the div move out to almost the center of the window. Why? CSS and HTML are below
<body>
<div class="login">
<div class="container">
<div class="col-md-12">
<div class="row">
<form action="https://www.blah/login"/>
<h3>Login</h3>
<div class="col-xs-4">UserName:</div>
<div class="col-xs-8"><input class="rounded white" type="text" name="username" placeholder="Username:" required/><br></div>
<div class="col-xs-4">Password:</div>
<div class="col-xs-8"><input class="rounded white" type="password" name="password" placeholder="Password:" required/><br></div>
<input type="checkbox" name="retrieve" value="true"/>I forgot my password.
<ul class="no-bullets">
<li><input class="color-brown white rounded float-left" type="submit" name="register" value="Submit Now"></li>
<li><input class="rounded margin-left-5px" data-dismiss="modal" type="submit" value="Cancel"></li>
</ul>
</div>
</div>
</div>
</div>
</body>
CSS----
.login {
height: 200px;
width: 330px;
max-width: 330px;
padding: 10px 20px 10px 20px;
background-color: #242424;
border: 1px solid #545454;
border-radius: 5px;
color: #ddd;
}
JS Fiddle
The elements containing your labels (.col-xs-4) have a width: 33.33333%.
The elements containing your input fields (.col-xs-8) have a width: 66.6666667%.
When the screen is narrow these width values are small and the labels and inputs are close together.
When the screen expands, these width values expand as well, creating a progressively larger gap between label and input.
The answer is to give the container a width constraint.
Add this style to the container class:
.col-md-12 { max-width: 250px; }
I tested it in Chrome and it works. Also, here's a live demo:
http://jsfiddle.net/y0psw5dn/
You seemed to inproperly set .login to height:200px.
.login{
/*height:200px*/
}
Is is what you want?
Try this.
<div class="login">
<div class="row">
<div class="col-md-12">
<form action="https://www.blah/login" />
<h3>Login</h3>
<div class="col-xs-4">UserName:</div>
<div class="col-xs-8">
<input class="rounded white" type="text" name="username" placeholder="Username:" required/>
<br>
</div>
<div class="col-xs-4">Password:</div>
<div class="col-xs-8">
<input class="rounded white" type="password" name="password" placeholder="Password:" required/>
<br>
</div>
<input type="checkbox" name="retrieve" value="true" />I forgot my password.
<ul class="no-bullets">
<li>
<input class="color-brown white rounded float-left" type="submit" name="register" value="Submit Now">
</li>
<li>
<input class="rounded margin-left-5px" data-dismiss="modal" type="submit" value="Cancel">
</li>
</ul>
</div>
</div>
</div>
.login {
height: 200px;
width: 330px;
max-width: 330px;
padding: 10px 20px 10px 20px;
background-color: #242424;
border: 1px solid #545454;
border-radius: 5px;
color: #ddd;
}
JSfiddle
Just put the .login div under the .container div. Below the code is
<div class="container">
<div class="login">
See the jsfiddle demo.
I changed your structure. There was some wrong. You can check this demo on jsfiddle
I also using Bootstrap 3 here Just Check it out this code.
Your HTML code structure is not organized here. First you need to understand its row and columns architecture what the purpose Behind it.
and Here on many places you open the div but you are not closing your at proper Location Where you need to close it.
I used this HTML Code :
<div class="container">
<div class="col-md-12 login">
<form action="https://www.blah/login"/>
<h3>Login</h3>
<div class="row">
<div class="col-xs-4">UserName:</div>
<div class="col-xs-8">
<input class="rounded white" type="text" name="username" placeholder="Username" required/><br>
</div>
</div>
<div class="row">
<div class="col-xs-4">Password:</div>
<div class="col-xs-8">
<input class="rounded white" type="password" name="password" placeholder="Password" required/><br>
</div>
</div>
<div class="row">
<div class="col-md-12">
<input type="checkbox" name="retrieve" value="true"/> I forgot my password.
</div>
</div>
<div class="row">
<div class="col-md-6">
<input class="bg-default btn-font" type="submit" name="register" value="Submit Now">
</div>
<div class="col-md-6">
<input class="bg-default btn-font" data-dismiss="modal" type="submit" value="Cancel">
</div>
</div>
</div>
and css code is here:
.login { height: 200px; width: 330px; max-width: 330px; padding: 10px 0px 10px 20px; background-color: #242424; border: 1px solid #545454; border-radius: 10px; color: #ddd; } .btn-font{ color: #000; }
and here is my running fiddle Example:
For Demo Click Here
hi please check below code it should be within container...
<div class="container">
<div class="login">
<div class="col-md-12">
<div class="row">
<form action="https://www.blah/login"/>
<h3>Login</h3>
<div class="col-xs-4">UserName:</div>
<div class="col-xs-8"><input class="rounded white" type="text" name="username" placeholder="Username:" required/><br></div>
<div class="col-xs-4">Password:</div>
<div class="col-xs-8"><input class="rounded white" type="password" name="password" placeholder="Password:" required/><br></div>
<input type="checkbox" name="retrieve" value="true"/>I forgot my password.
<ul class="no-bullets">
<li><input class="color-brown white rounded float-left" type="submit" name="register" value="Submit Now"></li>
<li><input class="rounded margin-left-5px" data-dismiss="modal" type="submit" value="Cancel"></li>
</ul>
</div>
</div>
</div>
check the demo here
Just change your upper starting structure of your html like this only
<div class="container">
<div class="row-fluid">
<div class="login">
the problem is with your html structure still many wrong things are
present you can make it better just try to improve by understanding the grid system of Bootstrap
it happens because of the improper structure sequence so that
here is the working demo jsfiddle
DEMO check out
here i tried to modify your code my way you can check out
.login {
height:280px;
max-width:250px;
padding: 10px 20px 10px 20px;
background-color: #242424;
border: 1px solid #545454;
border-radius: 5px;
color: #ddd;
}
.temp_div{
float: left;
margin-top: 10px;
}
.forgetPass_check{
padding-right:5px;
vertical-align:bottom;
padding-left: 15px;
}
.forgetPass_label{
padding-left:10px;
}
.no-bullets{
list-style-type: none;
margin: 0;
padding-left: 15px;
}
ul.no-bullets li{
float: left;
padding-right: 20px;
color:black;
}
<div class="container">
<div class="row-fluid">
<div class="login">
<form action="https://www.blah/login"/>
<h3 class="text-center">Login</h3>
<div class="col-xs-8"><label>UserName:</label><input class="rounded white" type="text" name="username" placeholder="Username:" required/></div>
<div class="col-xs-8"><label>Password:</label><input class="rounded white" type="password" name="password" placeholder="Password:" required/></div>
<div class="temp_div">
<div class="forgetPass_check">
<input type="checkbox" name="retrieve" value="true"/><label class="forgetPass_label">I forgot my password.</label>
</div>
<div class="button_wrapper">
<ul class="no-bullets">
<li><input class="color-brown white rounded float-left" type="submit" name="register" value="Submit Now"></li>
<li><input class="rounded margin-left-5px" data-dismiss="modal" type="submit" value="Cancel"></li>
</ul>
</div>
</div>
</div>
</div>
</div>
here is the demo code as well
Please Check Out Modified
even you can check this
Another try