Alignment issue in a form container - html

would you have any idea why my red alert message is split into 2 blocks? I'd like it to be one block under the main message field. See http://jsfiddle.net/z4Lg4/
Many thanks
HTML
<div id="contactwrapper">
<div class="block clear">
<div class="block-left">
<h1>Nous contacter</h1>
<div id="addressbox">
<h3>CENTRE DE dfd</h3>
<p>3, rdsfr</p>
<p> L5341 dfsf (Luxembourg)</p>
<ul id="contact">
<li><i class="icon-phone-sign blue"></i> +352 691 123.456</li>
<li><i class="icon-envelope blue"> </i>contact#dfdsf.lu</li>
<li><i class="icon-map-marker blue"></i> Plan d'accès</li>
</ul>
</div> <!-- End DIV addressbox -->
</div> <!-- End DIV block-left -->
<div class="block-right"> <h1>Formulaire de contact</h1>
<!-- CONTACT FORM-->
<div class="contact-form">
<form id="contactfrm" method="post" class="clearfix">
<div class="clearfix">
<input id="name" name="name" placeholder="Nom" type="text" value="">
<input id="email" name="email" placeholder="Email" type="email" value="">
</div>
<textarea id="message" name="message" placeholder="Message et coordonnées"></textarea>
<input type="submit" value="Envoyer" name="submit">
<p class="success" style="display:none">Votre message a bien été envoyé! Merci</p>
<p class="error" style="display:none;">E-mail not valid et/ou message vide</p>
</form>
</div><!-- /.contact-form -->
</div> <!-- End DIV block-right -->
</div> <!-- End DIV Block -->
</div> <!-- End DIV Contactwrapper -->
CSS
#contactwrapper {
margin-top: 30px;
padding-bottom: 30px;
position: relative;
display: block;
margin-right: auto;
margin-left: auto;
width: 980px;
background: #fff;
-webkit-box-shadow: 0px 0px 10px 2px #e0e0e0;
-moz-box-shadow: 0px 0px 10px 2px #e0e0e0;
box-shadow: 0px 0px 10px 2px #e0e0e0;
}
.block-left {
float: left;
box-sizing: border-box;
width: 50%;
padding-right: 20px;
}
.block-right {
float: right;
box-sizing: border-box;
width: 50%;
overflow: hidden;
}
.block {
display: block;
margin-right: auto;
margin-left: auto;
clear: both;
box-sizing: border-box;
padding-left: 20px;
padding-right: 20px;
width: 100%;
overflow: hidden;
}
.contact-form input[type=text] {
float: left;
width: 200px;
}
.contact-form input[type=email] {
float: right;
width: 200px;
}
.contact-form input[type=submit] {
float: right;
}
.contact-form textarea {
float: left;
height: 70px;
margin-bottom: 10px;
margin-top: 20px;
width: 100%;
}
/*************************************************************
/*************************************************************
* FORMS
*************************************************************/
form label { cursor: pointer }
form textarea,
form input[type=text],
form input[type=password],
form input[type=email] {
background: #d5d5d5 url('../images/form-bg.png') left top repeat-x;
border-top: 1px solid transparent;
border-right: 1px solid #d2d2d2;
border-bottom: 1px solid transparent;
border-left: 1px solid #d2d2d2;
color: #7c7c7c;
font-family: 'Arial', sans-serif;
padding: 6px 8px;
resize: none;
}
form input:focus,
form textarea:focus {
background: #d5d5d5 none;
border: 1px solid red;
outline: none;
}
form input[type=submit] {
background: #0064C4 url('../images/form-caret.png') right center no-repeat;
border: 0;
color: #fff;
cursor: pointer;
font-family: 'Arial', sans-serif;
font-size: 14px;
font-weight: normal;
padding: 8px 50px;
text-transform: uppercase;
}
.success
{
display:none;
display: block;
margin: auto;
width: 100%;
overflow: hidden;
text-align:center;
font-size: 14px;
font-weight: 600;
color: #fff;
letter-spacing: 1px;
padding-top: 3px;
padding-bottom: 3px;
background: #99CB97;
}
.error
{
display:none;
display: block;
background:#EF6666;
display:inline;
padding: 3px 10px 3px 10px;
top: 10px;
}

check the js fiddle
http://jsfiddle.net/z4Lg4/
.error
{
display:none;
display: block;
background:#EF6666;
display:inline;
top: 72px;
position:absolute;
}

made the changes:
css:
.error
{
display:none;
display: block;
background:#EF6666;
display:inline;
top: 100px;
margin-left:35px;
position:absolute;
}
Fiddle

Related

How to move the text higher in input label and do enter when reaching end line?

I have input label where there might be a lot of text.
how it looks now
I would like to have this 'Type something' in the left up corner. What is more, I would like to have an enter when we are closing to right border (end line). Currently it looks like this:
not making enter when reaching end line
I would like to have enter there.
Could you tell me how can I make these two improvements?
* {
margin: 0;
padding: 0;
}
header {
width: 1920;
height: 1080px;
}
body {
display: flex;
flex-direction: column;
min-height: 100vh;
margin: 0;
height: 1080px;
width: auto;
background-image: linear-gradient(180deg, #EFEFEF00 0%, #0F4A37 100%);
}
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: black;
color: white;
text-align: center;
}
footer img {
margin-top: 5px;
height: 30px;
display: inline-block;
padding: 0px 10px 0px 0px;
}
.main-nav {
float: right;
color: #000000;
margin-top: 40px;
margin-right: 0px;
}
.main-nav li {
display: inline-block;
}
.main-nav li a {
color: #000000;
text-decoration: none;
font: Bold 25px/15px Arial;
padding: 5px;
}
#logo {
margin-top: 10px;
float: left;
}
#sign a {
background-color: #DCDFDE;
padding: 30px 15px 17px 15px;
border-top: 3px solid black;
border-bottom: 3px solid black;
border-left: 3px solid black;
border-right: 3px solid black;
}
#profilesign {
margin-top: 400px;
margin-left: 250px;
font: Bold 40px/40px Georgia;
letter-spacing: 0;
color: black;
}
.left {
-webkit-border-radius: 20px;
-khtml-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 150px 150px;
}
img.left {
padding: 0px 40px 20px 40px;
width: 250px;
height: 250px;
margin-left: 400px;
margin-top: 500px;
}
article input {
width: 300px;
height: 40px;
background: white;
border-radius: 4px;
text-decoration: none;
text-align: center;
font: Bold 25px/12px Arial;
border-radius: 120;
border-style: none;
padding: 6px;
margin-left: 1000px;
margin-top: 500px;
}
article #textSign {
font-size: 50px;
color: black;
text-align: center;
}
#centerText {
text-align: center;
}
#something {
width: 700px;
height: 300px;
text-align: justify;
}
<header>
<div class="row">
<ul id="logo"> <img src="css-images/dingdog-logo.png"> </ul>
<ul class="main-nav">
<li style="padding-left:10px">PROFILE</li>
<li style="padding-left:10px">MAP</li>
<li style="padding-left:10px">YOUR FRIENDS</li>
<li style="padding-left:10px">MAILBOX</li>
<li style="padding-left:10px" id="sign">LOG OUT</li>
</ul>
</div>
<section>
<article>
<p id="profilesign">Feel free to send us a question.</p>
<img class="left" src="css-images/mial.jpg" style='position:absolute;left:0px; top:0px;' />
<div>
<p id="centerText">
<label><input type="email" name="email" placeholder="Email" style='margin-top:250px;position:absolute;left:0px; top:0px;' ></label><br/>
<label><input type="name" name="name" placeholder="Name" style="margin-top: 350px; position:absolute;left:0px; top:0px;"></label><br>
<label><input type="subject" name="subject" placeholder='Subject:' style="margin-top: 450px; position:absolute;left:0px; top:0px;"></label><br></p>
<label><input type="something" name="something" placeholder='Type something' id="something" style="margin-top: 550px; position:absolute;left:0px; top:0px;"></label><br></p>
<label id="submit"><input type="submit" name="send" value="Send" style="margin-top: 900px;position:absolute;left:0px; top:0px; background: #2699FB 0% 0% no-repeat padding-box;"></label>
</div>
</article>
</section>
</header>
<footer>
<img src="social/instagram.png" />
<img src="social/twitter-white-logo.png" />
<img src="social/facebook.png" />
</footer>
I would suggest using a textarea for that. I made some changes to the CSS also
* {
margin: 0;
padding: 0;
}
header {
width: 1920;
height: 1080px;
}
body {
display: flex;
flex-direction: column;
min-height: 100vh;
margin: 0;
height: 1080px;
width: auto;
background-image: linear-gradient(180deg, #EFEFEF00 0%, #0F4A37 100%);
}
footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: black;
color: white;
text-align: center;
}
footer img {
margin-top: 5px;
height: 30px;
display: inline-block;
padding: 0px 10px 0px 0px;
}
.main-nav {
float: right;
color: #000000;
margin-top: 40px;
margin-right: 0px;
}
.main-nav li {
display: inline-block;
}
.main-nav li a {
color: #000000;
text-decoration: none;
font: Bold 25px/15px Arial;
padding: 5px;
}
#logo {
margin-top: 10px;
float: left;
}
#sign a {
background-color: #DCDFDE;
padding: 30px 15px 17px 15px;
border-top: 3px solid black;
border-bottom: 3px solid black;
border-left: 3px solid black;
border-right: 3px solid black;
}
#profilesign {
margin-top: 400px;
margin-left: 250px;
font: Bold 40px/40px Georgia;
letter-spacing: 0;
color: black;
}
.left {
-webkit-border-radius: 20px;
-khtml-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 150px 150px;
}
img.left {
padding: 0px 40px 20px 40px;
width: 250px;
height: 250px;
margin-left: 400px;
margin-top: 500px;
}
article input,
article textarea {
width: 300px;
height: 40px;
background: white;
border-radius: 4px;
text-decoration: none;
text-align: center;
font: Bold 25px/12px Arial;
border-radius: 120;
border-style: none;
padding: 6px;
margin-left: 1000px;
margin-top: 500px;
}
article #textSign {
font-size: 50px;
color: black;
text-align: center;
}
#centerText {
text-align: center;
}
#something {
width: 300px;
height: 150px;
text-align: justify;
}
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>DingDog</title>
<link rel="stylesheet" href="css-images/style-contact.css">
</head>
<body>
<header>
<div class="row">
<ul id="logo"> <img src="css-images/dingdog-logo.png"> </ul>
<ul class="main-nav">
<li style="padding-left:10px">PROFILE</li>
<li style="padding-left:10px">MAP</li>
<li style="padding-left:10px">YOUR FRIENDS</li>
<li style="padding-left:10px">MAILBOX</li>
<li style="padding-left:10px" id="sign">LOG OUT</li>
</ul>
</div>
<section>
<article>
<p id="profilesign">Feel free to send us a question.</p>
<img class="left" src="css-images/mial.jpg" style='position:absolute;left:0px; top:0px;' />
<div>
<p id="centerText">
<label><input type="email" name="email" placeholder="Email" style='margin-top:250px;position:absolute;left:0px; top:0px;' ></label><br/>
<label><input type="name" name="name" placeholder="Name" style="margin-top: 350px; position:absolute;left:0px; top:0px;"></label><br>
<label><input type="subject" name="subject" placeholder='Subject:' style="margin-top: 450px; position:absolute;left:0px; top:0px;"></label><br></p>
<label><textarea name="something" placeholder='Type something' id="something" cols="50" rows="15" style="margin-top: 550px; position:absolute;left:0px; top:0px;"></textarea></label><br>
<label id="submit"><input type="submit" name="send" value="Send" style="margin-top: 900px;position:absolute;left:0px; top:0px; background: #2699FB 0% 0% no-repeat padding-box;"></label>
</div>
</article>
</section>
</header>
<footer>
<img src="social/instagram.png" />
<img src="social/twitter-white-logo.png" />
<img src="social/facebook.png" />
</footer>
</body>
</html>

Checkbox disappear

I'm trying to get my checkbox inline with the text using display:block and display:inline. When I use this the checkbox disappear and don't show the full size.
I have tried to read and find other ways to solve this but I'm stuck.
Is there any other way to get the checkbox in same line as the text?
Please help a student :)
grid_newsletter {
background: #ffeb3a;
}
.grid_newsletter .text {
text-align: center;
font-size: 24px;
font-weight: 600;
margin-bottom: 41px;
}
.grid_newsletter input {
width: 380px;
border-top: transparent;
border-left: transparent;
border-right: transparent;
margin-left: 20px;
border-bottom: 2px solid black;
padding-left: 0px;
}
.grid_newsletter input[type="checkbox"] {
width: 22px;
height: 22px;
border: 2px solid black;
text-align: center;
display: inline;
}
.grid_newsletter .checkbox_terms {
margin-top: 23px;
display: block;
}
.grid_newsletter .content {
text-align: center;
padding: 70px 55px 30px 60px;
display: inline;
}
.grid_newsletter .text_box_newsletter {
background: white;
width: 495px;
height: 90px;
text-align: center;
margin-top: 27px;
margin-left: auto;
margin-right: auto;
}
.grid_newsletter .text_box_newsletter p {
padding-top: 39px;
padding-bottom: 35px;
text-align: center;
font-weight: 600;
font-size: 18px;
letter-spacing: 0.100em;
}
<div class="grid_newsletter">
<div class="content">
<div class="text">Newsletter!</div>
<form>
<input type="text" name="firstname" placeholder="förnamn">
<input type="email" name="email" placeholder="e-post">
</form>
<div class="checkbox_terms">
<input type="checkbox" name="confirm">
<span class="save">Jag godkänner att mina uppgifter lagras.</span>
<span class="terms">Läs mer om vår hantering av data och vår integritetspolicy här.</span>
</div> <!-- checkbox_terms -->
<div class="text_box_newsletter">
<p>skicka</p>
</div>
</div> <!-- content -->
</div> <!-- grid_newsletter -->
`
You can use display: inline-block or display: inline together with vertical-align: middle on the involved elements.
grid_newsletter {
background: #ffeb3a;
}
.grid_newsletter .text {
text-align: center;
font-size: 24px;
font-weight: 600;
margin-bottom: 41px;
}
.grid_newsletter input {
width: 380px;
border-top: transparent;
border-left: transparent;
border-right: transparent;
margin-left: 20px;
border-bottom: 2px solid black;
padding-left: 0px;
}
.grid_newsletter input[type="checkbox"] {
width: 22px;
height: 22px;
border: 2px solid black;
text-align: center;
display: inline;
}
.grid_newsletter .checkbox_terms {
margin-top: 23px;
display: block;
}
.grid_newsletter .content {
text-align: center;
padding: 70px 55px 30px 60px;
display: inline;
}
.grid_newsletter .text_box_newsletter {
background: white;
width: 495px;
height: 90px;
text-align: center;
margin-top: 27px;
margin-left: auto;
margin-right: auto;
}
.grid_newsletter .text_box_newsletter p {
padding-top: 39px;
padding-bottom: 35px;
text-align: center;
font-weight: 600;
font-size: 18px;
letter-spacing: 0.100em;
}
.vAlign {
display: inline-block;
vertical-align: middle;
}
<div class="grid_newsletter">
<div class="content">
<div class="text">Newsletter!</div>
<form>
<input type="text" name="firstname" placeholder="förnamn">
<input type="email" name="email" placeholder="e-post">
</form>
<div class="checkbox_terms">
<input type="checkbox" name="confirm" class="vAlign">
<span class="save vAlign">Jag godkänner att mina uppgifter lagras.</span>
<span class="terms vAlign">Läs mer om vår hantering av data och vår integritetspolicy här.</span>
</div> <!-- checkbox_terms -->
<div class="text_box_newsletter">
<p>skicka</p>
</div>
</div> <!-- content -->
</div> <!-- grid_newsletter -->
When You use the display block you have to give it a width and height and float left so it will act line inline for that part.
You can also use the height according to your need .
I hope this is what you were looking for .
grid_newsletter {
background: #ffeb3a;
}
.grid_newsletter .text {
text-align: center;
font-size: 24px;
font-weight: 600;
margin-bottom: 41px;
}
.grid_newsletter input {
width: 380px;
border-top: transparent;
border-left: transparent;
border-right: transparent;
margin-left: 20px;
border-bottom: 2px solid black;
padding-left: 0px;
}
.grid_newsletter input[type="checkbox"] {
border: 2px solid black;
text-align: center;
display: block;
width: 20px;
height:15px;
float: left;
}
.grid_newsletter .checkbox_terms {
margin-top: 23px;
display: block;
}
.grid_newsletter .content {
text-align: center;
padding: 70px 55px 30px 60px;
display: inline;
}
.grid_newsletter .text_box_newsletter {
background: white;
width: 495px;
height: 90px;
text-align: center;
margin-top: 27px;
margin-left: auto;
margin-right: auto;
}
.grid_newsletter .text_box_newsletter p {
padding-top: 39px;
padding-bottom: 35px;
text-align: center;
font-weight: 600;
font-size: 18px;
letter-spacing: 0.100em;
}
<div class="grid_newsletter">
<div class="content">
<div class="text">Newsletter!</div>
<form>
<input type="text" name="firstname" placeholder="förnamn">
<input type="email" name="email" placeholder="e-post">
</form>
<div class="checkbox_terms">
<input type="checkbox" name="confirm">
<span class="save">Jag godkänner att mina uppgifter lagras.</span>
<span class="terms">Läs mer om vår hantering av data och vår integritetspolicy här.</span>
</div> <!-- checkbox_terms -->
<div class="text_box_newsletter">
<p>skicka</p>
</div>
</div> <!-- content -->
</div> <!-- grid_newsletter -->
use vertical-align:middle as shown below for textbox:
.grid_newsletter input[type="checkbox"] {
width: 22px;
height: 22px;
border: 2px solid black;
text-align: center;
display: inline;
vertical-align: middle;/*Newly added*/
}

CSS :last-of-type is not working

I am creating an HTML form and adding CSS to it. My HTML looks like
<html>
<body>
<div class="pt-form row">
<!-- This will be the top layer for input box -->
<div class="pt-form-input-group">
<label>Label1</label>
<div class="pt-input-text-group">
<input type="tel" class="pt-form-input">
</div>
</div>
<div class="pt-form-input-group">
<label>Label2</label>
<div class="pt-input-text-group">
<input type="tel" class="pt-form-input">
</div>
</div>
<!-- This will be of type drop-down -->
<div class="pt-form-input-group">
<label>Label3</label>
<div class="pt-input-text-group">
<input type="tel" class="pt-form-input">
</div>
</div>
<div class="pt-form-input-group">
<label>Label4</label>
<div class="pt-input-text-group">
<input type="tel" class="pt-form-input">
</div>
</div>
<div class="pt-form-submit">
ADD
</div>
</div>
<!-- build:js scripts/main.min.js -->
<script src="scripts/main.js"></script>
</body>
</html>
and CSS looks like
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
*:focus {
outline: none;
}
html,
body {
/*background-color: #ecf0f1;*/
background-color: white;
color: black;
font-family: 'Lato', 'Arial', sans-serif;
font-weight: 400;
font-size: 20px;
text-rendering: optimizeLegibility;
overflow-x: hidden;
}
.row {
max-width: 1140px;
margin: 0 auto;
}
/* --- Form */
.pt-form {
margin-top: 10%;
margin-left: 25%;
}
.pt-form-input-group {
position: relative;
font-size: 14px;
border: 1px solid #d3d5d8;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-bottom: none;
width: 50%;
}
.pt-form-input-group:last-of-type {
border-bottom: 1px solid #d3d5d8;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
margin-bottom: 10%;
}
.pt-form-input-group label {
color: #6f8691;
display: block;
margin-left: 2%;
margin-top: 2%;
}
.pt-input-text-group {
position: relative;
display: table;
border-collapse: separate;
width: 100%;
}
.pt-form-input {
height: 60px;
width: 100%;
padding: 15px 12px 10px;
font-size: 22px;
line-height: 32px;
border: none;
}
.pt-form-submit {
background-color: darkorchid;
height: 60px;
width: 50%;
margin-top: 2%;
padding-top: 20px;
padding-left: 20%;
}
.pt-form-submit a {
color: white;
width: 100%;
text-decoration: none;
}
I want to draw border on the last input box, and I do
.pt-form-input-group:last-of-type {
border-bottom: 1px solid #d3d5d8;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
margin-bottom: 10%;
}
But the border does not show up. The demo is available at https://codepen.io/harit66/pen/jBjamj
What am I doing wrong?
:last-of-type works with elements, not classes. You could put the .pt-form-input-group elements in their own parent, then target with :last-child
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
*:focus {
outline: none;
}
html,
body {
/*background-color: #ecf0f1;*/
background-color: white;
color: black;
font-family: 'Lato', 'Arial', sans-serif;
font-weight: 400;
font-size: 20px;
text-rendering: optimizeLegibility;
overflow-x: hidden;
}
.row {
max-width: 1140px;
margin: 0 auto;
}
/* --- Form */
.pt-form {
margin-top: 10%;
margin-left: 25%;
}
.pt-form-input-group {
position: relative;
font-size: 14px;
border: 1px solid #d3d5d8;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
border-bottom: none;
width: 50%;
}
.pt-form-input-group:last-child {
border-bottom: 1px solid #d3d5d8;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
margin-bottom: 10%;
}
.pt-form-input-group label {
color: #6f8691;
display: block;
margin-left: 2%;
margin-top: 2%;
}
.pt-input-text-group {
position: relative;
display: table;
border-collapse: separate;
width: 100%;
}
.pt-form-input {
height: 60px;
width: 100%;
padding: 15px 12px 10px;
font-size: 22px;
line-height: 32px;
border: none;
}
.pt-form-submit {
background-color: darkorchid;
height: 60px;
width: 50%;
margin-top: 2%;
padding-top: 20px;
padding-left: 20%;
}
.pt-form-submit a {
color: white;
width: 100%;
text-decoration: none;
}
<html>
<body>
<div class="pt-form row">
<div>
<!-- This will be the top layer for input box -->
<div class="pt-form-input-group">
<label>Label1</label>
<div class="pt-input-text-group">
<input type="tel" class="pt-form-input">
</div>
</div>
<div class="pt-form-input-group">
<label>Label2</label>
<div class="pt-input-text-group">
<input type="tel" class="pt-form-input">
</div>
</div>
<!-- This will be of type drop-down -->
<div class="pt-form-input-group">
<label>Label3</label>
<div class="pt-input-text-group">
<input type="tel" class="pt-form-input">
</div>
</div>
<div class="pt-form-input-group">
<label>Label4</label>
<div class="pt-input-text-group">
<input type="tel" class="pt-form-input">
</div>
</div>
</div>
<div class="pt-form-submit">
ADD
</div>
</div>
<!-- build:js scripts/main.min.js -->
<script src="scripts/main.js"></script>
</body>
</html>

Button not sticking next to field

I'm trying to position my button so it sticks next to the input field.
Like here:
In the example i just showed there, the button had a position relative and a float right. I did the exact same thing but it didn't work.
Here is my fiddlesticks:
.subscribe input {
font: 15px/25px Georgia, Times, 'Times New Roman', serif;
border: 2px solid black;
height: 40px;
width: 340px;
font-style: italic;
padding-left: 10px;
}
.subscribe button {
height: 40px;
width: 53px;
background-color: black;
color: white;
padding-left: 10px 10px 10px 10px;
float: right;
position: relative;
border: 2px solid black;
}
.textboxwhite-left {
padding: 40px 20px 0px 20px;
color: black;
text-align: left !important;
}
#container {
display: block;
height: 900px;
width: 100%;
position: relative;
top: 50px;
margin: 0;
color: white;
text-align: center;
}
<div id="container">
<div class="textboxwhite-left">
<form class="subscribe" action="" method="post">
<input type="text" name="subscribefield" required="true" placeholder="Awe" />
<button type="submit">Search</button>
</form>
</div>
</div>
Does this works for you?
.subscribe{ display:inline-block;}
Please check this code.
.subscribe input {
font: 15px/25px Georgia, Times, 'Times New Roman', serif;
border: 2px solid black;
height: 40px;
width: 340px;
font-style: italic;
padding-left: 10px;
float: left;
}
.subscribe button {
height: 46px;
width: 80px;
background-color: black;
color: white;
padding-left: 10px 10px 10px 10px;
float: left;
position: relative;
border: 2px solid black;
}
.textboxwhite-left {
padding: 40px 20px 0px 20px;
color: black;
text-align: left !important;
}
#container {
display: block;
height: 900px;
width: 100%;
position: relative;
top: 50px;
margin: 0;
color: white;
text-align: center;
}
<div id="container">
<div class="textboxwhite-left">
<form class="subscribe" action="" method="post">
<input type="text" name="subscribefield" required="true" placeholder="Awe" />
<button type="submit">Search</button>
</form>
</div>
</div>
added display:inline-block to .textboxwhite-left and adjusted height and width of button according to input.
.subscribe input {
font: 15px/25px Georgia, Times, 'Times New Roman', serif;
border: 2px solid black;
height: 40px;
width: 340px;
font-style: italic;
padding-left: 10px;
}
.subscribe button {
height: 46px;
width: 58px;
background-color: black;
color: white;
padding-left: 10px 10px 10px 10px;
float: right;
position: relative;
border: 2px solid black;
}
.textboxwhite-left {
padding: 40px 20px 0px 20px;
color: black;
text-align: left !important;
display : inline-block;
}
#container {
display: block;
height: 900px;
width: 100%;
position: relative;
top: 50px;
margin: 0;
color: white;
text-align: center;
}
<div id="container">
<div class="textboxwhite-left">
<form class="subscribe" action="" method="post">
<input type="text" name="subscribefield" required="true" placeholder="Awe" />
<button type="submit">Search</button>
</form>
</div>
</div>
Try this:
<div class="search">
<form>
<input type="text" placeholder="serach here">
<input class="submit" value="Seach">
</form>
</div>
Css:
.search{
position:relative;
padding:0px 100px 10px 10px;
}
.search input[type="text"]{
border:2px solid black;
border-radius:3px;
width:100%;
height:30px;
line-height:30px;
display:block;
}
.search input[type="text"]:focus{
-webkit-appearance: none;
appearance: none;
outline:none;
}
.search .submit{
position:absolute;
width:100px;
height:30px;
text-align:center;
right:0;
border:2px solid black;
top:0;
cursor: pointer;
}
.search .submit:hover{
background:black;color:#fff;
}
Here is jsfiddle link : https://jsfiddle.net/jmc548vc/1/
Please do have a look at this Fiddle.
.subscribe button {
height: 46px;
width: 53px;
background-color: black;
color: white;
padding-left: 10px 10px 10px 10px;
float: right;
position: absolute; \\this is changed to absolute
border: 2px solid black;
}

why is my css staggered?

Here is my html:
<div id="header">
<p id="logout">register</p>
<h1>header.</h1>
</div>
<div id="main">
<p>login.</p>
<form method="post" action="index.php" name="loginform" id="loginform">
<fieldset>
<label for="username">u:</label><input type="text" name="username" id="username" />
<br>
<label for="password">p:</label><input type="password" name="password" id="password" />
<br>
<input type="submit" name="login" id="login" value="Login" />
</fieldset>
</form>
</div>
And here is my CSS:
* {
margin: 0;
padding: 0;
}
body {
/*font-family: Trebuchet MS;*/
font-family: Helvetica;
}
a {
color: #000;
}
a:hover, a:active, a:visited {
text-decoration: none;
}
#logout { font-size: 12px;}
#header {
width: 700px;
margin: 0 auto;
margin-top: 0px;
font-size: 25px;
padding: 10px;
border-bottom: 1px solid #CCC;
border-right: 1px solid #CCC;
border-left: 1px solid #CCC;
background-color: #EEE;
}
#slogan { font-size:20px;}
#main {
width: 700px;
margin: 0 auto;
margin-top: 20px;
padding: 10px;
border: 1px solid #CCC;
background-color: #EEE;
}
#contact {
width: 700px;
margin: 0 auto;
margin-top: 20px;
padding: 10px;
border: 1px solid #CCC;
background-color: #EEE;
}
p { font-size: 20px; }
form fieldset { border: 0; }
form fieldset p br { clear: left; }
label {
margin-top: 5px;
font-size: 20px;
display: block;
width: 30px;
padding: 0;
float: left;
}
input {
font-family: Trebuchet MS;
border: 1px solid #CCC;
margin-bottom: 5px;
background-color: #FFF;
padding: 2px;
}
input:hover {
border: 1px solid #222;
background-color: #EEE;
}
I can't figure out why my forms are coming out like this: http://cl.ly/2c1b0w3h3S142Q2s3A3I
Instead of lined up nicely on the left.
Your second label is catching on the corner of your first, since the label is taller than the text box.
Two solutions here...you can either make sure the label and box are the same height, or add a clear: left to your labels.
It's those float: lefts; you'll notice each label comes to the right of the previous ones. If you need the floats -- and I'm not sure you do -- then you need to use "clear".
Wrap your each of label and input pairs in a div and eliminate the brs.