Aligning inputs ontop & next to eachover - html

I am trying to align 2 inputs on top of eachover next to another 2 inputs on top of each other. Here is what it keeps giving me:
http://prntscr.com/33k6bq
It seems to have no problems with 2 of them, but with another 2 next to them it just doesn't want to work.
Here is the style for them:
CSS:
.loginbutton {
font-family: 'Nunito';
color: #fff;
font-size: 16px;
background-image: url(../images/gradient.png);
background-position: 0, center;
display: inline-block;
background-color: #81bb0f;
height: 71px;
width: 100px;
margin-left: 10px;
box-shadow:0 0 0 1px rgba(0,0,0,.25) inset,0 0 0 2px rgba(255,255,255,.25) inset;
border: 1px solid #919191;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 2px;
padding: 10px
}
HTML:
<form method="post" id="phase-0-form">
<input type="text" id="habbo-name" placeHolder="Username" size="35" value="<?php echo $template->form->reg_username; ?>" name="reg_username" class="logintext" maxlength="32">
<input type="text" id="email" size="35" placeHolder="Email" name="reg_email" value="<?php echo $template->form->reg_email; ?>" class="logintext" maxlength="48"><br>
<input type="password" id="password" placeHolder="Password" size="35" name="reg_password" value="" class="logintext" maxlength="32" style="float: left;">
<input type="password" id="password2" placeHolder="Confirm Password" size="35" name="reg_rep_password" value="" class="logintext" maxlength="32">
<input type="password" id="seckey" size="35" placeHolder="Security Key" name="reg_seckey" value="1111" hidden="yes" class="text-field" maxlength="4" >
<button type="submit" name="register" class="loginbutton" style="float: right">Register NOW</button>
</form>

There are many ways to fix this. With the lack of information you provided, I can suggest you two things:
simply add a line break (<br>) after the second input
put the inputs inside a container and make sure the container's width allow two input fields to fit in, but not three

Updated JSFiddle here
You had a float: right in your CSS (in input.logintext) - this is what was messing it up.
I also removed style="float: left;" from the password input as this is not required
Update: I've re-ordered the fields and added buttons to the divs
HTML:
<div id="logincontainer">
<form method="post" id="phase-0-form">
<div style="float:left;">
<div class="regbutton">Go back to Index</div>
</div>
<div style="float:left;">
<input type="text" id="habbo-name" placeHolder="Username" size="35" value="<?php echo $template->form->reg_username; ?>" name="reg_username" class="logintext" maxlength="32" /><br />
<input type="password" id="password" placeHolder="Password" size="35" name="reg_password" value="" class="logintext" maxlength="32" />
</div>
<div style="float:left;">
<input type="text" id="email" size="35" placeHolder="Email" name="reg_email" value="<?php echo $template->form->reg_email; ?>" class="logintext" maxlength="48" /><br />
<input type="password" id="password2" placeHolder="Confirm Password" size="35" name="reg_rep_password" value="" class="logintext" maxlength="32" />
<input type="password" id="seckey" size="35" placeHolder="Security Key" name="reg_seckey" value="1111" hidden="yes" class="text-field" maxlength="4" />
</div>
<div style="float:left;">
<button type="submit" name="register" class="loginbutton">Register NOW</button>
</div>
</form>
</div>
<div id="container">
<div class="image"></div>
</div>
CSS:
#import url(http://fonts.googleapis.com/css?family=Lato);
#import url(http://fonts.googleapis.com/css?family=Ubuntu);
#import url(http://fonts.googleapis.com/css?family=Nunito);
body {
background: url(../images/bg2.png) repeat-x bottom fixed;
background-color: #3aa4e2;
font-family:'Lato';
margin-top: 70px;
}
#container {
display: block;
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
height: 371px;
width: 780px;
border: 1px solid #919191;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #fff;
padding: 10px;
margin-top: 10px
}
input.logintext {
width: 180px;
height: 12px;
padding: 10px;
border: 1px solid #919191;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 2px;
}
.loginbutton {
font-family:'Nunito';
color: #fff;
font-size: 16px;
background-image: url(../images/gradient.png);
background-position: 0, center;
display: inline-block;
background-color: #81bb0f;
height: 71px;
width: 100px;
margin-left: 10px;
box-shadow:0 0 0 1px rgba(0, 0, 0, .25) inset, 0 0 0 2px rgba(255, 255, 255, .25) inset;
border: 1px solid #919191;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 2px;
padding: 10px
}
.regbutton {
text-align: center;
font-family:'Nunito';
color: #fff;
font-size: 16px;
background-image: url(../images/gradient.png);
background-position: 0, center;
float: left;
display: inline-block;
background-color: #e70505;
height: 37px;
margin-right: 21px;
width: 100px;
box-shadow:0 0 0 1px rgba(0, 0, 0, .25) inset, 0 0 0 2px rgba(255, 255, 255, .25) inset;
border: 1px solid #919191;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 2px;
padding: 16px
}
.fbbutton {
text-align: center;
font-family:'Nunito';
color: #fff;
font-size: 16px;
background-image: url(../images/gradient.png);
background-position: 0, center;
float: left;
display: inline-block;
background-color: #3b5998;
height: 37px;
width: 100px;
box-shadow:0 0 0 1px rgba(0, 0, 0, .25) inset, 0 0 0 2px rgba(255, 255, 255, .25) inset;
border: 1px solid #919191;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 2px;
padding: 16px;
margin-right: 10px
}
.usersonline {
text-align: center;
font-family:'Nunito';
color: #919191;
font-size: 16px;
background-image: url(../images/gradient.png);
background-position: 0, center;
float: left;
display: inline-block;
background-color: #e6e6e6;
height: 37px;
margin-right: 21px;
width: 100px;
box-shadow:0 0 0 1px rgba(0, 0, 0, .25) inset, 0 0 0 2px rgba(255, 255, 255, .25) inset;
border: 1px solid #919191;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 2px;
padding: 16px
}
.loginbutton:hover, .regbutton:hover, .fbbutton:hover, .usersonline:hover {
opacity: 0.8;
}
#logincontainer {
top: 0;
left: 0;
bottom: 0;
right: 0;
margin: auto;
border: 1px solid #919191;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
background-color: #fff;
padding: 10px;
height: 70px;
width: 780px;
}
.image {
background: url(../images/mainimg2.png);
height: 371px;
width: 780px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}

Its hard to tell from just css and screenshot, but my guess would be to warp them in div like this:
<div>
<input />
<input />
</div>
<div>
<input />
<input />
</div>
And arrange them later with css

Related

Having issues with CSS border-radius

I am adding the following code to my CSS file for my parent div .outertContainer but the border-radius is only affecting the top two corners and not the bottom two corners. I cannot seem to figure it out. Everything else seems to work fine.
*{
background-color: white;
margin: 0;
padding: 0;
}
.outerContainer{
position: absolute;
border-radius: 9px;
top:23%;
right: 10%;
width:30%;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1), 0 4px 14px 0 rgba(0, 0, 0, 0.17);
}
.input-form-control{
margin-top: 20px;
margin-left: 16px;
width: 80%;
padding: 16px 24px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: white;
line-height: 10px;
font-size: 16px;
}
::placeholder {
color: #99a3a4;
}
.submit-btn{
margin-top: 18px;
margin-left: 17px;
margin-bottom: 65px;
border-radius: 4px;
border: none;
color: white;
padding: 13px 20px;
width: 92%;
text-align: center;
text-decoration: none;
display: inline-block;
}
The following is the html code:
<div className="LoginPage">
<div className="outerContainer">
<form name="form">
<div className="emailLabelInput">
<input type="text" className="login-form-control" name="email" placeholder="Email address"/>
</div>
<div className="passwordLabelInput">
<input type="password" className="login-form-control" name="password" placeholder="Password"/>
</div>
<div className="form-group">
<button className="submit-btn">Log in</button>
</div>
</form>
</div>
</div>
Your problem is you have * { background: white; } which makes the background of all the elements white. Since the form is just as large as the outerContainer and does NOT have a border-radius, it effectively covers up the border-radius applied to the outerContainer. So you have two options to fix the problem:
1 — Remove * { background: white; }. This works for the most part except that the two inputs are still positioned in the top left corner of the outerContainer and of course still covering that corner. If you have those positioned a little differently, this would work.
2 — Add padding: 10px to the outerContainer. This will give the outerContainer a little bit of 'breathing room' and keep the form from covering the corners. See the snippet below.
*{
background:white;
margin: 0;
padding: 0;
}
.LoginPage{
height:100vh;
width:100vw;
}
.outerContainer{
padding:10px; /* Added to show radius */
position: absolute;
border-radius: 9px;
top:23%;
right: 10%;
width:30%;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.1), 0 4px 14px 0 rgba(0, 0, 0, 0.17);
}
.input-form-control{
margin-top: 20px;
margin-left: 16px;
width: 80%;
padding: 16px 24px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: white;
line-height: 10px;
font-size: 16px;
}
::placeholder {
color: #99a3a4;
}
#error-message{
border: 1px solid #ff7f50;
margin-top: 10px;
margin-left: 16px;
width: 80%;
padding: 16px 24px;
border-radius: 4px;
line-height: normal;
font-size: 15px;
}
.submit-btn{
margin-top: 18px;
margin-left: 17px;
margin-bottom: 65px;
border-radius: 4px;
border: none;
color: white;
padding: 13px 20px;
width: 92%;
text-align: center;
text-decoration: none;
display: inline-block;
}
<div class="LoginPage">
<div class="outerContainer">
<form name="form">
<div class="emailLabelInput">
<input type="text" class="login-form-control" name="email" placeholder="Email address"/>
</div>
<div class="passwordLabelInput">
<input type="password" class="login-form-control" name="password" placeholder="Password"/>
</div>
<div class="form-group">
<button class="submit-btn">Log In</button>
</div>
</form>
</div>
</div>

html - how to left align labels?

I'm trying to left align labels keeping input-fields right-aligned without success!
I was able to align labels or input-fields but not both of them! I've tried a lot of things but nothing worked
html:
<body style="background-color:lightgray;">
<center> <div class="form-style-2">
<div class="form-style-2-heading">Info</div>
<form action="" method="POST">
<label for="cod"><span>Cod <span class="required">*</span></span><input type="text" class="input-field" name="cod" value="" /></label>
<label for="name" ><span>Name <span class="required">*</span></span><input type="text" class="input-field" name="name" value="" /></label>
<label for="phone"><span>Phone <span class="required">*</span></span><input type="text" class="input-field" name="phone" value="" /></label>
<label for="address"><span>Address <span class="required">*</span></span><input type="text" class="input-field" name="address" value="" /></label>
<label><span> </span><input type="submit" value="Submit" /></label>
</form></center>
</div>
</body>
css
.form-style-2{
max-width: 500px;
padding: 20px 12px 10px 20px;
font: 13px Arial, Helvetica, sans-serif;
}
.form-style-2-heading{
font-weight: bold;
font-style: italic;
border-bottom: 2px solid #000;
margin-bottom: 20px;
font-size: 15px;
padding-bottom: 3px;
}
.form-style-2 label{
display: block;
margin: 0px 0px 15px 0px;
}
.form-style-2 label > span{
width: 100px;
font-weight: bold;
float: left;
padding-top: 8px;
padding-right: 5px;
}
.form-style-2 span.required{
color:red;
}
.form-style-2 input.input-field{
width: 48%;
}
.form-style-2 input.input-field,
.form-style-2 .textarea-field{
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
border: 1px solid #C2C2C2;
box-shadow: 1px 1px 4px #EBEBEB;
-moz-box-shadow: 1px 1px 4px #EBEBEB;
-webkit-box-shadow: 1px 1px 4px #EBEBEB;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
padding: 7px;
outline: none;
}
.form-style-2 .input-field:focus,
.form-style-2 .textarea-field:focus{
border: 1px solid #0C0;
}
.form-style-2 .textarea-field{
height:100px;
width: 55%;
}
.form-style-2 input[type=submit],
.form-style-2 input[type=button]{
border: none;
padding: 8px 15px 8px 15px;
background: #4CAF50;
color: #fff;
box-shadow: 1px 1px 4px #DADADA;
-moz-box-shadow: 1px 1px 4px #DADADA;
-webkit-box-shadow: 1px 1px 4px #DADADA;
border-radius: 3px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
}
.form-style-2 input[type=submit]:hover,
.form-style-2 input[type=button]:hover{
background: #EA7B00;
color: #fff;
}
jfiddle: https://jsfiddle.net/uv21fc5o/
You don't want to use the <center> tag. Try using auto margins as I've done here:
https://jsfiddle.net/uv21fc5o/1/
.form-style-2{
max-width: 500px;
padding: 20px 12px 10px 20px;
font: 13px Arial, Helvetica, sans-serif;
margin: 0 auto;
}
Align the text left like so:
CSS
.form-style-2 label > span {
text-align: left;
}

Align subscribe form

I'm trying to align the subscribe form just beneath the featured image. I used a subscribe form I found on codepen.io and I'm not sure how to position this form. I'm adding the html and css. If anyone can help me with this I'd greatly appreciate it. Thanks in advance.
Current Output:
#mc_embed_signup {
background: none;
font: 14px Helvetica, Arial, sans-serif;
margin: 500px;
padding: 0;
}
.email_capture--wrapper {
max-width: 600px;
display: block;
margin: 5% -70px;
padding: 0 15px;
}
.mailchimp {
width: 100%;
}
.mailchimp input[type="email"] {
background: #f5f5f5;
height: 55px;
padding: 18px 20px;
font-size: 20px;
margin-bottom: 15px;
border: none;
outline: none;
color: #444;
float: left;
-webkit-appearance: none;
-webkit-border-radius: 4px 0px 0px 4px;
-moz-border-radius: 4px 0px 0px 4px;
border-radius: 4px 0px 0px 4px;
-webkit-box-shadow: inset 0 -1px rgba(0, 0, 0, 0.1);
-moz-box-shadow: inset 0 -1px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 -1px rgba(0, 0, 0, 0.1);
}
.mailchimp input[type="submit"] {
font-size: 18px;
height: 55px;
float: left;
-webkit-border-radius: 0px 4px 4px 0px;
-moz-border-radius: 0px 4px 4px 0px;
border-radius: 0px 4px 4px 0px;
}
}
#media (max-width: 767px) {
.mailchimp .form-group > input[type="email"] {
-webkit-border-radius: 4px 4px 4px 4px;
-moz-border-radius: 4px 4px 4px 4px;
border-radius: 4px 4px 4px 4px;
}
.mailchimp .form-group > input[type="submit"] {
width: 100%;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
}
<div class="pull-right">
<!-- Navigation -->
<nav class="navbar navbar-fixed-top pull-right">
<div class="container">
<!-- Begin MailChimp Signup Form -->
<link href="..." rel="stylesheet" type="text/css">
</div>
</nav>
</div>
</div>
<!--end of pull-right -->
<div id="mc_embed_signup">
<form action="..." method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
<div id="mc_embed_signup_scroll">
<label for="mce-EMAIL"></label>
<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>
<!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
<div id="signup">
<input type="text" name="..." tabindex="-1" value="">
</div>
<div>
<input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</div>
</form>
</div>

How do I move the input boxes in a sign in form closer together?

<div class="Login">
<input type="text" placeholder="Full Name" id="Full Name">
<input type="password" placeholder="Password" id="Password">
forgot password?
<input type="submit" value="Sign In">
</div>
That's my code above but boxes are too far apart. I want them within a few px of each other. I have tried changing the margin and padding on my .css file with no luck. Here is my css below;
.Login {
background: #eceeee;
border: 1px solid #42464b;
border-radius: 6px;
height: 242px;
margin: 15px auto 0;
margin-top: 6px;
width: 288px;
padding-top: 6px;
padding-bottom: 1px;
padding-right: 10px;
}
.Login h1 {
background-image: linear-gradient(top, #f1f3f3, #d4dae0);
border-bottom: 1px solid #a6abaf;
border-radius: 6px 6px 0 0;
box-sizing: border-box;
color: #727678;
display: block;
height: 43px;
font: 600 14px/1 'Open Sans', sans-serif;
padding-top: 6px;
padding-bottom: 1px;
margin: 0px;
text-align: center;
text-shadow: 0 -1px 0 rgba(0,0,0,0.2), 0 1px 0 #fff;
what do I code do I need to change or add to make them closer?
Thanks :)
If you want the input boxes to be closer, you just have to add a negative margin.
.Login > input {
margin-right: -3px;
}
https://jsfiddle.net/do6qhg74/
Or you use float to position the elements next to each other:
.Login > input {
float: left;
}
https://jsfiddle.net/3eq7jwwk/
I changed your code a little bit
.Login {
background: #eceeee;
border: 1px solid #42464b;
border-radius: 6px;
height: 242px;
margin: 15px auto 0;
margin-top: 6px;
width: 500px;
padding-top: 6px;
padding-bottom: 1px;
padding-right: 10px;
text-align:center;
}
.Login h1 {
background-image: linear-gradient(top, #f1f3f3, #d4dae0);
border-bottom: 1px solid #a6abaf;
border-radius: 6px 6px 0 0;
box-sizing: border-box;
color: #727678;
display: block;
height: 43px;
font: 600 14px/1 'Open Sans', sans-serif;
padding-top: 6px;
padding-bottom: 1px;
margin: 0px;
text-align: center;
text-shadow: 0 -1px 0 rgba(0,0,0,0.2), 0 1px 0 #fff; }
.submit, .password {
margin-left:-3px;
}
<div class="Login">
<input type="text" placeholder="Full Name" id="Full Name">
<input class="password" type="password" placeholder="Password" id="Password">
<input class="submit" type="submit" value="Sign In"><br><br>
forgot password?
</div>
(Just press Run snippet)

Align a logo and a Search Box using CSS

I having problems trying to get a log and a search box to go side by side. The logo on the left and the search box on the right.
header {
background:#383838;
height: 130px;
border-top:10px solid #2C2C2C; border-bottom:1px solid #2C2C2C;
}
.wrap-header {
width:960px;
position:relative;
margin: 0px auto;
}
header #logo {
position:absolute;
top:40px;
left: 30px;
width: 100%;
}
header #search,
header #submit {
position: absolute;
top: 60px;
right: 20px;
width: 258px;
z-index: 15;
}
header #search {
padding: 5px 9px;
height: 20px;
width: 300px;
border: 1px solid #a4c3ca;
background: #f1f1f1;
border-radius: 50px 3px 3px 50px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 1);
}
header #submit
{
background-color: #6cbb6b;
background-image: linear-gradient(#95d788, #6cbb6b);
border-radius: 3px 50px 50px 3px;
border-width: 1px;
border-style: solid;
border-color: #7eba7c #578e57 #447d43;
box-shadow: 0 0 1px rgba(0, 0, 0, 0.3),
0 1px 0 rgba(255, 255, 255, 0.3) inset;
height: 35px;
margin: 0 0 0 10px;
padding: 0;
width: 90px;
cursor: pointer;
font: bold 14px Arial, Helvetica;
color: #23441e;
text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
header #submit:hover {
background-color: #95d788;
background-image: linear-gradient(#6cbb6b, #95d788);
}
header #submit:active {
background: #95d788;
outline: none;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
}
header #submit::-moz-focus-inner {
border: 0; /* Small centering fix for Firefox */
}
header #search::-webkit-input-placeholder {
color: #9c9c9c;
font-style: italic;
}
<header>
<div class="wrap-header">
<div id="logo"><img src="./images/logo.png"/></div>
<form id="searchbox" action="search.php" method="post">
<input id="search" type="text" placeholder="Type here" name="search">
<input name="submit" type="submit" id="submit" formmethod="POST" value="Search">
</form>
</div>
</header>
What is happening is the logo is okay but the submit button for the search-box is inside the text-box for the search.
Just edit following css header #search class
header #search {
padding: 5px 9px;
height: 20px;
margin-right: 90px;
width: 300px;
border: 1px solid #a4c3ca;
background: #f1f1f1;
border-radius: 50px 3px 3px 50px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) inset, 0 1px 0 rgba(255, 255, 255, 1);
}
It will do the job well.. Here is the preview
Edit
You need toadd min-width to your header element
Here's working jsfiddle http://jsfiddle.net/otbay822/
<header>
<div class="wrap-header">
<div id="logo" class="inline-div">
<img src="./images/logo.png"/>
</div>
<div class="inline-div">
<form id="searchbox" action="search.php" method="post">
<input id="search" type="text" placeholder="Type here" name="search">
<input name="submit" type="submit" id="submit" formmethod="POST" value="Search">
</form>
</div>
</div>
</header>
CSS:
.inline-div{
display:inline-block;
}
I Wrapped the Form in a div and applied a class too both the form and the logo div. And then simply applied display:inline-block;
Hope it Helps.