Form Input element sizing - html

I want to make a two column layout form. but I am getting a problem i.e input elements of form are not equally divided in size(width) and also responsive.
I want it to be responsive and also equally width with gap between them.
Attached Code Below
#import url('https://fonts.googleapis.com/css?family=Montserrat');
h2 {
font-family: Montserrat;
font-size: 3em;
line-height:50px;;
}
form {
width:70%;
margin: 10% auto;
}
input[type="text"]{
display: block;
height: 30px;
width: 47%;
float:left;
}
form > input:nth-child(3){
margin-left: 31px;
margin-right:0;
}
textarea {
width:100%;
box-sizing: border-box;
margin: 30px 0;
}
input[placeholder="Name"],input[placeholder="E-mail"]{
padding: 10px;
letter-spacing: 5px;
font-family: Montserrat;
}
textarea[placeholder="Message"]{
letter-spacing:5px;
padding: 10px;
font-family: Montserrat;
}
/*
input , textarea {
border-width: 0 0 2px 0;
border-color: #000;
}*/
form input,textarea:focus {
outline:none;
}
<section id="contact-page">
<form>
<h2>Contact Us</h2>
<input type="text" placeholder="Name">
<input type="text" placeholder="E-mail">
<textarea name="message" placeholder="Message" rows="6"></textarea>
</form>
</section>

Try This
<form>
<div class="col-sm-6 col-xs-12 form-group">
<input type="text" name="" class="form-control">
</div>
<div class="col-sm-6 col-xs-12 form-group">
<input type="email" name="" class="form-control">
</div>
<div class="col-sm-12 form-group">
<textarea name="" cols="" rows="10" class="form-control"></textarea>
</div>
<form>
Just add this to your form section and also add the required files for botstrap
1- Jquery
2- Bootsrap.min.css
Bootsrap Documentation
JS fiddle

Remove float for inputs and add a wrapper div as below
h2 {
font-family: Montserrat;
font-size: 3em;
line-height:50px;;
}
form {
width:70%;
margin: 10% auto;
}
#email{
display: block;
height: 30px;
width: 30%;
float:left;
margin:0;
margin-left:2%;
}
#name{
display: block;
height: 30px;
width: 30%;
}
form > input:nth-child(3){
margin-left: 31px;
margin-right:0;
}
textarea {
width:100%;
box-sizing: border-box;
margin: 30px 0;
}
input[placeholder="Name"],input[placeholder="E-mail"]{
padding: 10px;
letter-spacing: 5px;
font-family: Montserrat;
}
textarea[placeholder="Message"]{
letter-spacing:5px;
padding: 10px;
font-family: Montserrat;
}
/*
input , textarea {
border-width: 0 0 2px 0;
border-color: #000;
}*/
form input,textarea:focus {
outline:none;
}
<section>
<form>
<h2>Contact Us</h2>
<div style="display: flex; justify-content: space-between;">
<input type="text" placeholder="Name">
<input type="text" placeholder="E-mail">
</div>
<textarea name="message" placeholder="Message" rows="6"></textarea>
</form>
</section>

If possible use Bootstrap with Grids, if not easy solution will be add div like this:
Bootstrap Grid LinK: https://www.w3schools.com/bootstrap/bootstrap_grid_system.asp
<form>
<h2>Contact Us</h2>
<div>
<input type="text" placeholder="Name">
</div>
<div>
<input type="text" placeholder="E-mail">
</div>
<textarea name="message" placeholder="Message" rows="6"></textarea>
</form>

Your selector form > input:nth-child(3) is a problem because it counts the h2 as the first, making the email-input the third and adding left-margin to it.
Once that is gone, I added margin: 30px 0; to the existing input['text'] selector, to match what you had applied to the textarea, and you may want different values, but everything is lined up and evenly spaced:
JS Fiddle

Example :
h2 {
font-family: Montserrat;
font-size: 3em;
line-height:50px;;
}
form {
width:70%;
margin: 10% auto;
}
#email{
display: block;
height: 30px;
width: 30%;
float:left;
margin:0;
margin-left:2%;
}
#name{
display: block;
height: 30px;
width: 30%;
float:left;
}
form > input:nth-child(3){
margin-left: 31px;
margin-right:0;
}
textarea {
width:100%;
box-sizing: border-box;
margin: 30px 0;
}
input[placeholder="Name"],input[placeholder="E-mail"]{
padding: 10px;
letter-spacing: 5px;
font-family: Montserrat;
}
textarea[placeholder="Message"]{
letter-spacing:5px;
padding: 10px;
font-family: Montserrat;
}
/*
input , textarea {
border-width: 0 0 2px 0;
border-color: #000;
}*/
form input,textarea:focus {
outline:none;
}
<section id="contact-page">
<form>
<h2>Contact Us</h2>
<input type="text" placeholder="Name" id='name'>
<input type="text" placeholder="E-mail" id='email'>
<textarea name="message" placeholder="Message" rows="6"></textarea>
</form>
</section>

Well ! i tried to figure out your problem and just gave a try to make it responsive.
Max-width and Max-height
The max-width property is used to set the maximum width of an element.
The max-width can be specified in length values, like px, cm, etc., or in percent (%) of the containing block, or set to none (this is default. Means that there is no maximum width).
Using max-width instead, in this situation, will improve the browser's handling of small windows. similarly for height
You can remove margin: 0 auto; if you want don't want your content centred
#import url('https://fonts.googleapis.com/css?family=Montserrat');
h2 {
white-space: auto;
font-family: Montserrat;
font-size: 3em;
line-height: 50px;
;
}
form {
width: 70%;
margin: 0 auto;
}
input[type="text"] {
max-height: 30px;
max-width: 47%;
}
textarea {
max-width: 100%;
box-sizing: border-box;
margin: 10px 0;
}
input[placeholder="Name"],
input[placeholder="E-mail"] {
padding: 10px;
letter-spacing: 5px;
font-family: Montserrat;
margin-bottom: 10px;
}
textarea[placeholder="Message"] {
letter-spacing: 5px;
padding: 10px;
font-family: Montserrat;
}
/*
input , textarea {
border-width: 0 0 2px 0;
border-color: #000;
}*/
form input,
textarea:focus {
outline: none;
}
<section id="contact-page">
<form>
<h2>Contact Us</h2>
<input type="text" placeholder="Name">
<input type="text" placeholder="E-mail">
<textarea name="message" placeholder="Message" rows="6"></textarea>
</form>
</section>

Related

How do I remove the padding inside a div that has a propery of display and a value of inline-block

How do I remove the padding from inside of a div with the display set to "inline-block".
Below is the html and css.
.showExpCusWrap {
background-color: #A8D3FF;
display: inline-block;
border: 1px solid #004F9D;
padding: 0px 10px;
font-family: Tahoma;
}
.showExpCusWrap label {
font-size: 0.9em;
margin: 0px;
padding: 0px;
}
.showExpCusWrap input[type="date"] {
margin: 0px;
padding: 0px;
}
<div class="showExpCusWrap">
<label for="showExpFrom">From</label>
<input type="date" name="showExpFrom" id="showExpFrom">
<label for="showExpTo">To</label>
<input type="date" name="showExpTo" id="showExpTo">
<input type="button" name="showExpCus" id="showExpCus" value="Show" class="exp-button-small">
</div>
This is how it looks. Notice the top and bottom padding inside.
I have checked the broswer default styling. It does not set any padding. So, how to remove those? I want all the elements inside the div to appear without any spacing from top or bottom.
While editing your question, I realized that there's no problem.
Here's a snippet of all the code that you sent.
.showExpCusWrap {
background-color: #A8D3FF;
display: inline-block;
border: 1px solid #004F9D;
padding: 0px 10px;
font-family: Tahoma;
}
.showExpCusWrap label {
font-size: 0.9em;
margin: 0px;
padding: 0px;
}
.showExpCusWrap input[type="date"]{
margin: 0px;
padding: 0px;
}
<div class="showExpCusWrap">
<label for="showExpFrom">From</label>
<input type="date" name="showExpFrom" id="showExpFrom">
<label for="showExpTo">To</label>
<input type="date" name="showExpTo" id="showExpTo">
<input type="button" name="showExpCus" id="showExpCus" value="Show" class="exp-button-small">
</div>
You may use line-height increase or decrease it , this is to be check through different browsers of course .. (form elements are also part of the browser not only html tags).
.showExpCusWrap {
background-color: #A8D3FF;
display: inline-block;
border: 1px solid #004F9D;
padding: 10px;
font-family: Tahoma;
}
.showExpCusWrap label {
font-size: 0.9em;
margin: 0px;
padding: 0px;
}
.showExpCusWrap input[type="date"] {
margin: 0px;
padding: 0px;
}
/* increase all
label, input:not([type="button"]) {
line-height:1.4em;
}
*/
label,
input {
vertical-align: middle;
box-sizing:border-box;
}
/* or decrease the one
[type="button"] {
line-height: 1em;
}
<div class="showExpCusWrap">
<label for="showExpFrom">From</label>
<input type="date" name="showExpFrom" id="showExpFrom">
<label for="showExpTo">To</label>
<input type="date" name="showExpTo" id="showExpTo">
<input type="button" name="showExpCus" id="showExpCus" value="Show" class="exp-button-small">
</div>
I have come to this solution. May be this is the solution you are looking for. To your .showExpCusWrap class I add these lines of CSS and it's work for me.
/* add the following code*/
line-height:1;
font-size:0.9em;
As you declare a relative font-size with em value; So to adjust the height of the inline block I took same amount of height with the help of line-height:1;. Here is full code for you.
.showExpCusWrap {
background-color: #A8D3FF;
display: inline-block;
border: 1px solid #004F9D;
padding: 0px 10px;
font-family: Tahoma;
/* add the following code*/
line-height: 1;
font-size: 0.9em;
}
.showExpCusWrap label {
font-size: 0.9em;
margin: 0px;
padding: 0px;
}
.showExpCusWrap input[type="date"] {
margin: 0px;
padding: 0px;
}
* {
box-sizing: border-box;
}
<div class="showExpCusWrap">
<label for="showExpFrom">From</label>
<input type="date" name="showExpFrom" id="showExpFrom">
<label for="showExpTo">To</label>
<input type="date" name="showExpTo" id="showExpTo">
<input type="button" name="showExpCus" id="showExpCus" value="Show" class="exp-button-small">
</div>

A form and a coloured grid inline with each other

I have a contact form that has a width of 45% of the parent div. Instead of white space next to it, I'd like to add a coloured div (a square grid) and add some relevant info within said coloured div. However, with my current code, I'm, unable to get the form and div inline.
I've read some SO posts this one, but they are unable to assist (maybe it's the way I have my current CSS code)
#contact {
width: 90%;
height: 700px;
margin-left: 5%;
background-color: #fff;
border-radius: 10px;
color: #000 !important;
margin: 0 auto;
clear: none;
}
#contact #header {
padding: 10px 0px;
width: 100%;
font-size: 36px;
float: left;
}
#contact-text {
font-size: 16px;
width: 45%;
}
textarea, input, #contact-text {
font-family: Quicksand;
font-size: 16px;
}
label {
display: block;
padding: 1rem 0 .5rem;
text-transform: uppercase;
font-size: 22px;
}
input, textarea {
display: block;
width: 45%;
border: 1px solid black;
padding: .5rem;
}
textarea {
height: auto;
resize: none;
}
button {
font-family: Quicksand;
font-size: 18px;
border: 1px solid black;
padding:.5rem;
width: auto;
text-transform: uppercase;
}
button:hover {
cursor: pointer;
}
#contact #grid {
height: 100%
width: 50%;
background-color: #bbc6cb;
float: right;
overflow: hidden;
display: inline;
}
<div id = "contact">
<div id = "header">
<h3>Contact.</h3>
</div>
<div id = "contact-text">
<p>Please fill out the quick form below and we will get in touch as soon as we can</p>
</div>
<form action="/" id="contact-form" method="post" role="form">
<div class = "label">
<label for="name" class="formText">Name:</label>
</div>
<input id="name" name="name" type="text" placeholder="Your name" required="required">
<div class = "label">
<label for="email" class="formText">Email:</label>
</div>
<input id="email" name="email" type="text" placeholder="Your email" required="required">
<div class = "label">
<label for="message" class="formText">Message:</label>
</div>
<textarea id="message" name="message" placeholder="Enter your message here" rows="10" required="required"></textarea>
<div>
<button type="submit">Send</button>
</div>
</form>
<div id = "grid">
</div>
</div>
Use this below code:
#contact {
height: 700px;
background-color: #fff;
border-radius: 10px;
color: #000 !important;
margin: 0 auto;
clear: none;
max-width: 1140px;
}
.left-gird, .right-grid {
width: 49%;
float: left;
}
.left-gird {
margin-right: 1%;
}
.right-gird {
margin-left: 1%;
}
.color-box {
height: 400px;
background-color: gray;
}
#contact #header {
padding: 10px 0px;
width: 100%;
font-size: 36px;
float: left;
}
#contact-text {
font-size: 16px;
width: 45%;
}
textarea, input, #contact-text {
font-family: Quicksand;
font-size: 16px;
}
label {
display: block;
padding: 1rem 0 .5rem;
text-transform: uppercase;
font-size: 22px;
}
input, textarea {
display: block;
width: 100%;
border: 1px solid black;
padding: .5rem;
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
textarea {
height: auto;
resize: none;
}
button {
font-family: Quicksand;
font-size: 18px;
border: 1px solid black;
padding:.5rem;
width: auto;
text-transform: uppercase;
}
button:hover {
cursor: pointer;
}
#contact #grid {
height: 100%;
width: 50%;
background-color: #bbc6cb;
float: right;
overflow: hidden;
display: inline;
}
h3 {
margin-top: 0;
}
<div id = "contact">
<div class="left-gird">
<div id = "header">
<h3>Contact.</h3>
</div>
<div id = "contact-text">
<p>Please fill out the quick form below and we will get in touch as soon as we can</p>
</div>
<form action="/" id="contact-form" method="post" role="form">
<div class = "label">
<label for="name" class="formText">Name:</label>
</div>
<input id="name" name="name" type="text" placeholder="Your name" required="required">
<div class = "label">
<label for="email" class="formText">Email:</label>
</div>
<input id="email" name="email" type="text" placeholder="Your email" required="required">
<div class = "label">
<label for="message" class="formText">Message:</label>
</div>
<textarea id="message" name="message" placeholder="Enter your message here" rows="10" required="required"></textarea>
<div>
<button type="submit">Send</button>
</div>
</form>
</div>
<div class="right-grid">
<div class="color-box"> color box here</div>
</div>
</div>
Use float:left for form and next div for inline
#contact {
width: 90%;
height: 700px;
margin-left: 5%;
background-color: #fff;
border-radius: 10px;
color: #000 !important;
margin: 0 auto;
clear: none;
}
#contact #header {
padding: 10px 0px;
width: 100%;
font-size: 36px;
float: left;
}
#contact-text {
font-size: 16px;
width: 45%;
}
textarea, input, #contact-text {
font-family: Quicksand;
font-size: 16px;
}
label {
display: block;
padding: 1rem 0 .5rem;
text-transform: uppercase;
font-size: 22px;
}
input, textarea {
display: block;
width: 90%;
border: 1px solid black;
padding: .5rem;
}
textarea {
height: auto;
resize: none;
}
button {
font-family: Quicksand;
font-size: 18px;
border: 1px solid black;
padding:.5rem;
width: auto;
text-transform: uppercase;
}
button:hover {
cursor: pointer;
}
form{
float:left;
width:50%;
}
#contact #grid {
height: 100%;
width: 50%;
background-color: #bbc6cb;
float: right;
overflow: hidden;
float:left;
}
<div id = "contact">
<div id = "header">
<h3>Contact.</h3>
</div>
<div id = "contact-text">
<p>Please fill out the quick form below and we will get in touch as soon as we can</p>
</div>
<form action="/" id="contact-form" method="post" role="form">
<div class = "label">
<label for="name" class="formText">Name:</label>
</div>
<input id="name" name="name" type="text" placeholder="Your name" required="required">
<div class = "label">
<label for="email" class="formText">Email:</label>
</div>
<input id="email" name="email" type="text" placeholder="Your email" required="required">
<div class = "label">
<label for="message" class="formText">Message:</label>
</div>
<textarea id="message" name="message" placeholder="Enter your message here" rows="10" required="required"></textarea>
<div>
<button type="submit">Send</button>
</div>
</form>
<div id = "grid">
</div>
</div>

How to make the textarea label display correctly [duplicate]

This question already has answers here:
What methods of ‘clearfix’ can I use?
(29 answers)
HTML radio buttons allowing multiple selections
(6 answers)
Closed 4 years ago.
I created a responsive form which changes to two columns when the screen size is resized. It mostly works the way I want it to.
However the label for textarea keeps showing incorrectly. I want it to display on a new line, but it keeps showing in the area of radio buttons.
There is also an issue with radio buttons where both can be selected at the same time. I have been trying to figure out what I did wrong but I can't find a solution.
Here is my code on jsfiddle.
/* CSS */
.myForm {
padding: 40px 20px;
}
.myForm h2,
.myForm p {
text-align: center;
padding: 0 10px;
}
.myForm h2 {
margin-bottom: 20px;
font-size: 20px;
font-weight: bold;
font-family: sans-serif;
}
.myForm p {
margin-bottom: 20px;
font-size: 12px;
}
.myForm label {
font-size: 14px;
}
form input {
border: 1px solid #a9a9a9;
border-radius: 3px;
height: 25px;
width: 96%;
margin: 10px 0;
font-size: 14px;
padding: 5px;
}
.label,
.radio input[type="radio"] {
display: inline;
float: left;
width: auto;
margin: 10px 0;
padding: 0 10px;
}
input[type="radio"],
input.radio {
vertical-align: text-top;
width: 13px;
height: 13px;
padding: 0;
margin: 0;
position: relative;
overflow: hidden;
top: -8px;
right: 5px;
}
.msg textarea {
width: 96%;
border: 1px solid #a9a9a9;
border-radius: 3px;
margin: 10px 0;
font-size: 14px;
padding: 5px;
}
form button {
background-color: #a9a9a9;
color: #fff;
width: 100%;
text-transform: uppercase;
padding: 10px;
border: none;
border-radius: 3px;
}
#media only screen and (min-width: 768px) {
/*Left form column*/
.left {
display: block;
float: left;
width: 48%;
}
/*Right form column*/
.right {
display: block;
float: right;
width: 48%;
}
.label,
.radio input[type="radio"] {
padding-right: 30px;
padding-left: 30px;
}
}
<!-- HTML -->
<form class="myForm">
<h2>Lorem ipsum</h2>
<p>text</p>
<div class="fields">
<label class="left">First Name
<input type="text" name="other"></label>
<label class="right">Last Name
<input type="text" name="other"></label>
<label class="left">text
<input type="text" name="other"></label>
<label class="right">text
<input type="text" name="other"></label>
<label class="left">text
<input type="text" name="other"></label>
<label class="right">text
<input type="text" name="other"></label>
<label class="left">text
<input type="text" name="other"></label>
<div class="radio right">
<label>Some text</label><br>
<label class="label">
<input type="radio" name="phone" value="phone">Phone</label>
<label class="label close">
<input type="radio" name="email" value="email">Email</label>
</div>
<div class="msg">
<label>Message</label>
<textarea rows="5"></textarea>
</div>
</div>
<button type="button" name="button">Send</button>
</form>
this should help:
.msg{
clear:both;
}
To fix the two problems you describe:
Your radio buttons need to have the same name field to be in the same group. If you set name="contact" for both, then they'll no longer be selectable at the same time.
You should remove float: left; from your CSS rules for .radio input[type="radio"]. This is taking precedence over the display: block; of the .msg div and causing them to be displayed on the same line.

CSS divs not horizontally aligned properly [duplicate]

This question already has answers here:
Align inline-block DIVs to top of container element
(5 answers)
Closed 4 years ago.
This is probably a stupid question, but it has been driving me crazy the whole day. I need both divs with the class of contacthor to be aligned on the top, but not forcing them by using margin-top: -x or etc. Here is an image of the issue.
Also, Im new to web design so if I have useless code please explain.
Thanks.
#redcontact {
margin-bottom: 0;
padding-left: 5vh;
font-size: 15px;
line-height: 30px;
background: black;
}
.contacthor {
display: inline-block;
}
form > .contacthor > .input {
color: #C5B358;
font-size: 15px;
background-color: black;
margin-top: 0;
margin-left: 1vh;
margin-bottom: 1vh;
height: 30px;
width: 190px;
display: block;
}
.contacthor > textarea {
color: #C5B358;
font-size: 15px;
font-family: 'Montserrat', sans-serif;
width: 60vh;
height: 25vh;
background: black;
border: 1px;
border-style: solid;
border-radius: 3px;
border-color: grey;
padding-left: 4px;
margin-top: 0;
margin-bottom: 1vh;
margin-left: 1vh;
}
<div id="redcontact">
<form action="action_page.php">
<div class="contacthor">
<label for="name">Nombre</label>
<input class="input" type="text" name="name_user" placeholder="test">
<label for="org">Empresa</label>
<input class="input" type="text" name="org" placeholder="test">
<label for="mail">Mail</label>
<input class="input" type="text" name="mail" placeholder="contacto#test.com">
</div>
<div class="contacthor">
<p>Mensaje</p>
<textarea name="mensaje" tabindex="5" placeholder="text..."></textarea>
<input type="submit" value="enviar">
</div>
</form>
</div>
I would agree with Chere's answer in that you should be using something like CSS Grid or Flexbox. However, if you want to stay simple for this example, or just want to know why your code isn't working, here is a solution:
#redcontact {
margin-bottom: 0;
padding-left: 5vh;
font-size: 15px;
line-height: 30px;
background: black;
}
.contacthor {
display: inline-block;
}
form>.contacthor>.input {
color: #C5B358;
font-size: 15px;
background-color: black;
margin-top: 0;
margin-left: 1vh;
margin-bottom: 1vh;
height: 30px;
width: 190px;
display: block;
}
.contacthor>textarea {
color: #C5B358;
font-size: 15px;
font-family: 'Montserrat', sans-serif;
width: 60vh;
height: 25vh;
background: black;
border: 1px;
border-style: solid;
border-radius: 3px;
border-color: grey;
padding-left: 4px;
margin-top: 0;
margin-bottom: 1vh;
margin-left: 1vh;
}
.contacthor>p {
margin-bottom: 5px;
margin-top: 0;
margin-bottom: 1vh;
margin-left: 1vh;
}
.contacthor>input[value=enviar] {
display: block;
margin-top: 0;
margin-bottom: 1vh;
margin-left: 1vh;
}
/* ===== Styles to fix example ===== */
label, p {
color: white;
}
/* ===== Styles to answer your question ===== */
.contacthor {
vertical-align: top;
}
<div id="redcontact">
<form action="action_page.php">
<div class="contacthor">
<label for="name">Nombre</label>
<input class="input" type="text" name="name_user" placeholder="test">
<label for="org">Empresa</label>
<input class="input" type="text" name="org" placeholder="test">
<label for="mail">Mail</label>
<input class="input" type="text" name="mail" placeholder="contacto#test.com">
</div>
<div class="contacthor">
<p>Mensaje</p>
<textarea name="mensaje" tabindex="5" placeholder="text..."></textarea>
<input type="submit" value="enviar">
</div>
</form>
</div>
The main thing to take away from this is the addition of vertical-align: top. Here is a similar question and here is the documentation for the vertical-align property.
Note: I think there may have been some CSS missing, so the snippet looks a bit odd and I had to make a couple of unrelated changes.
Why is there a . before the input?
Also, I highly recommend not using vh or pixels. You should go with em. Without doing everything, you should probably try to do something like that, with flexbox.
#redcontact {
width: 100%;
height: 100%;
font-size: 15px;
line-height: 1.5;
background-color: #000;
color: #fff;
}
form {
display: flex;
padding: 2em;
.contacthor {
display: flex;
flex-direction: column;
width: 50%;
padding: 0 2em;
input,
textarea {
color: #C5B358;
background-color: transparent;
margin-left: 1em;
margin-bottom: 1em;
padding: 0.5em 1em;
width: auto;
display:block;
}
input {
border: 0;
}
textarea {
border: 1px solid grey;
border-radius: 3px;
}
}
}
I have made a grid. See if you are looking for somewhat similar thing.
https://codepen.io/kalpeshshende/pen/qJjomO
form{
display:grid;grid-gap:10px;
grid-template-columns:1fr 2fr;
}
.holder{
max-width:600px;
margin:auto;
background:black;
color:#C5B358;padding:10px;
}
.contacthor{
display:grid;grid-gap:10px;
}
textarea{
height:100px;
}
input[type=submit]{
width:120px;
}
p{
padding:0px;
}
input[type=text]{
background:black;
color:;border:none;
}
Markup :
<body>
<div class="holder">
<form action="">
<div class="contacthor">
<label for="name" >Nombre</label>
<input class="input" type="text" name="name_user" placeholder="test">
<label for="org">Empresa</label>
<input class="input" type="text" name="org" placeholder="test">
<label for="mail">Mail</label>
<input class="input" type="text" name="mail" placeholder="contacto#test.com">
</div>
<div class="contacthor">
<label for="Mensaje">Mensaje</label>
<textarea name="mensaje" tabindex="5" placeholder="text..."></textarea>
<input type="submit" value="enviar">
</div>
</form>
</div>
</body>
Try adding vertical-align: top; to contracthor.

CSS - Styling a form

I'm styling a form for a site and I need it to look like this -
My coded version, so far, looks like this -
The name & email sections for some reason won't size properly and there seems to be padding or margin properties somewhere which I can't seem to override. Here's my code as it stands -
form {
height: 200px;
width: 400px;
margin-right: 50px;
}
.name {
float: left;
}
input[type=text],
input[type=email] {
background: #F0F0F0;
font-size: 10px;
width: 100%;
height: 20px;
}
input[type=subject] {
background: #F0F0F0;
font-size: 10px;
width: 100%;
height: 20px;
}
textarea {
resize: vertical;
font-size: 10px;
width: 100%;
background: #F0F0F0;
height: 100px;
}
input[type=submit] {
background: #00bfff;
border: none;
color: #ffffff;
cursor: pointer;
font-size: 10px;
font-weight: 700;
width: 100%;
}
<div class="six columns">
<form>
<fieldset>
<div class="name">
<input type="text" required placeholder="NAME">
</div>
<div class="name">
<input type="email" required placeholder="EMAIL">
</div>
<div>
<input type="subject" placeholder="SUBJECT">
</div>
<div>
<textarea placeholder="MESSAGE..."></textarea>
</div>
</fieldset>
<input type="submit" value="SUBMIT">
</form>
</div>
UPDATE - Latest version.
I made a bunch of tweaks and kind of last track as I went, so I hope you're able to read through this and figure it out. If not, please feel free to ask questions!
form {
height: 200px;
width: 400px;
margin-right: 50px;
}
fieldset {
border: none;
padding: 0;
margin: 0;
display: flex;
}
div.row {
display: flex;
width: 100%;
}
div.row input {
margin-left: 5px;
}
div.row input:first-child {
margin-left: 0;
}
input[type=text],
input[type=email] {
background: #E8E8E8;
font-size: 10px;
width: 100%;
box-sizing: border-box;
border: 0;
padding: 0;
margin-bottom: 5px;
padding: 6px 12px;
}
textarea {
resize: none;
font-size: 10px;
background: #E8E8E8;
width: 100%;
box-sizing: border-box;
border: 0;
padding: 6px 12px;
margin-bottom: 5px;
}
input[type=submit] {
background: #1ba4dd;
border: none;
color: #ffffff;
cursor: pointer;
font-size: 10px;
font-weight: 700;
width: 100%;
padding: 8px 0;
}
input[type=submit]:hover {
background: #00bfff;
}
<div class="six columns">
<form>
<fieldset>
<div class="row">
<input name="name" type="text" required placeholder="NAME">
<input name="email" type="email" required placeholder="EMAIL">
</div>
<input name="subject" type="text" placeholder="SUBJECT">
<textarea rows="8" placeholder="MESSAGE..."></textarea>
</fieldset>
<input type="submit" value="SUBMIT">
</form>
</div>