I am currently working on a page Here
I am trying to style the form to be aligned as it is displayed in chrome.
I am sure my way of doing this is out of the park wrong but my styling is working in everything but safari and I cannot figure out why
This is the current code I am using....
<div>
<div>
<br />
<div class="required-notice">
<span class="required-star">*</span><span> = Required Field</span>
</div>
<div class="loan-form-body">
<div>
<span>First Name:</span><span class="required-star">*</span>
</div>
<div>
<input type="text" name="FirstName" id="firstname" class="validate required" style="width: 200px;" />
</div>
<div>
<span>Email Address:</span><span class="required-star">*</span>
</div>
<div>
<input type="text" name="EmailAddress" id="emailaddress" class="validate required" style="width: 200px;" />
</div>
<div>
<span>Address:</span><span class="required-star">*</span>
</div>
<div>
<input type="text" name="HomeAddress" id="HomeAddress" class="validate required" style="width: 430px;" />
</div>
<div>
<div>
<span style="text-align: left; position: absolute; margin-left: 40%; margin-top:-21%;">
Last Name:
<span class="required-star">*</span>
</span>
</div>
<div>
<input type="text" name="LastName" id="lastname" style="width: 200px; position: absolute; margin-left: 40%; margin-top: -18%;" />
</div>
<div style="position: absolute; margin-left: 40%; margin-top: -14%;">
Work Phone:
</div>
<div>
<input type="text" name="DaytimePhone" id="daytimephone" style="width: 200px; position: absolute; margin-left: 40%; margin-top: -10.7%;" />
</div>
</div>
<div class="submit">
<input type="submit" style="width: auto; outline: none; -webkit-appearance: none;" onclick="return validate();" class="button" data-form-type="submit" value="Get An Instant Report" />
</div>
Pardon the messy code.
I fixed your code a little and made some CSS, here's a FIDDLE
<form name="loan-form" class="loan-form" action="#">
<div class="required-notice">
<span class="required-star">*</span>= Required Field
</div>
<div class="loan-form-body">
<label>First Name:<span class="required-star">*</span></label>
<input type="text" name="FirstName" id="firstname" class="validate required" />
<label>Email Address:<span class="required-star">*</span></label>
<input type="text" name="EmailAddress" id="emailaddress" class="validate required" />
<label>Address:<span class="required-star">*</span></label>
<input type="text" name="HomeAddress" id="HomeAddress" class="validate required" />
<label>Last Name:<span class="required-star">*</span></label>
<input type="text" name="LastName" id="lastname" />
<label>Work Phone:</label>
<input type="text" name="DaytimePhone" id="daytimephone" />
<input type="submit" onclick="return validate();" class="button" data-form-type="submit" value="Get An Instant Report" />
</div>
</form>
.loan-form {
width: 400px;
padding: 10px;
font-family: Sans-serif;
font-size: 16px;
border: 1px solid #ddd;
}
.loan-form label {
float: left;
clear: left;
width: 150px;
}
.loan-form input[type="text"] {
float: left;
width: 200px;
margin: 0 0 12px;
padding: 2px 4px;
border: 1px solid #ddd;
outline: none;
transition: box-shadow 0.2s ease-in-out;
-moz-transition: box-shadow 0.2s ease-in-out;
-webkit-transition: box-shadow 0.2s ease-in-out;
}
.loan-form input[type="text"]:focus {
box-shadow: 0 0 3px 0 #333;
-moz-box-shadow: 0 0 3px 0 #333;
-webkit-box-shadow: 0 0 3px 0 #333;
}
.loan-form input[type="submit"] {
display: block;
width: 160px;
height: 26px;
margin: 0 auto;
}
.required-notice {
padding: 7px;
margin: 0 0 15px;
}
.required-star {
vertical-align: top;
margin: 0 3px;
font-size: 12px;
color: red;
}
just finish styling by you wish.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
What should I change in my CSS to put every i icon to correct input box?
..
What the hell I should edit there when is already answered...
.box_main {
width: 50%;
margin: 0 auto;
}
.box_main_content {
width: 200px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
background: linear-gradient(#ffffff, #f5f5f5);
padding: 20px;
margin: 20px 10px 20px 10px;
float: left;
}
.box_main_content_data {
padding: 1em 0 0 0;
text-align: center;
}
.inputWithIcon {
position: relative;
}
.inputWithIcon i {
position: absolute;
left: 0;
top: 8px;
padding: 19px 8px;
color: #aaa;
transition: 0.3s;
}
.inputWithIcon input:focus + i {
color: rgb(0, 0, 0);
}
input {
font-family: 'Nunito', sans-serif;
width: 100%;
border: 2px solid rgb(0, 0, 0);
margin: 8px 0;
outline: none;
padding: 5px;
box-sizing: border-box;
transition: 0.3s;
padding-left: 40px;
}
input:focus {
box-shadow: 0 0 8px 0 rgb(0, 0, 0);
}
.lost_pass {
border-top: 1px solid rgb(170, 170, 170);
margin: 1em 0 1em 0;
padding-top: 1em;
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<div class="box_main">
<div class="box_main_content">
<div class="box_title">
<i class='material-icons'>login</i>Přihlášení
</div>
<div class="box_main_content_data inputWithIcon">
<form method="post">
<input type="text" name="name" placeholder="Přihlašovací jméno nebo E-mail" required>
<i class='material-icons'>person</i>
<input type="password" name="password" placeholder="Heslo" onkeyup="lettersOnly(this)" required>
<i class='material-icons'>lock</i>
<br>
<button name="btn_login">Přihlásit se</button>
</form>
<div class="lost_pass">
<button name="btn_login">Zapomenuté heslo?</button>
</div>
</div>
</div>
<div class="box_main_content">
<div class="box_title">
<i class='material-icons'>person_add</i>Regsitrace
</div>
<div class="box_main_content_data inputWithIcon">
<form method="post">
<input class="inputWithIcon" type="text" name="name" placeholder="Přihlašovací jméno" onkeyup="lettersOnly(this)" required>
<i class='material-icons'>person</i>
<input type="password" name="password" placeholder="Heslo" onkeyup="lettersOnly(this)" required>
<i class='material-icons'>lock</i>
<input type="password" name="password_repeat" placeholder="Heslo znovu" onkeyup="lettersOnly(this)" required>
<i class='material-icons'>lock</i>
<input type="text" name="email" placeholder="E-Mail" required>
<i class='material-icons'>email</i>
<input type="text" name="firstname" placeholder="Jméno">
<i class='material-icons'>badge</i>
<input type="text" name="surname" placeholder="Příjmení">
<i class='material-icons'>badge</i>
<input type="date" name="age">
<i class='material-icons'>badge</i>
<label class="radio-checkbox">
<input type="radio" name="sex" value="0" checked>
<i class='material-icons'>male</i>
<span class="checkmark"></span>
</label>
<label class="radio-checkbox">
<input type="radio" name="sex" value="1">
<i class='material-icons'>female</i>
<span class="checkmark"></span>
</label>
</form>
</div>
</div>
</div>
Try to wrap every input with div and add class="inputWithIcon" to div's:
.box_main {
width: 50%;
margin: 0 auto;
}
.box_main_content {
width: 200px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
background: linear-gradient(#ffffff, #f5f5f5);
padding: 20px;
margin: 20px 10px 20px 10px;
float: left;
}
.box_title {
margin-left: 1em;
}
.box_main_content_data {
padding: 1em 0 0 0;
text-align: center;
}
.inputWithIcon {
position: relative;
}
.inputWithIcon i {
position: absolute;
left: 0;
top: 1px;
padding: 9px 8px;
color: #aaa;
transition: 0.3s;
}
.inputWithIconLabel i {
position: absolute;
left: 0;
top: -2px;
padding: 0px 8px;
color: #aaa;
transition: 0.3s;
}
.inputWithIcon input:focus + i {
color: rgb(0, 0, 0);
}
input {
font-family: 'Nunito', sans-serif;
width: 100%;
border: 2px solid rgb(0, 0, 0);
margin: 8px 0;
outline: none;
padding: 5px;
box-sizing: border-box;
transition: 0.3s;
padding-left: 40px;
}
input:focus {
box-shadow: 0 0 8px 0 rgb(0, 0, 0);
}
.lost_pass {
border-top: 1px solid rgb(170, 170, 170);
margin: 1em 0 1em 0;
padding-top: 1em;
}
<link
href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet"
/>
<div class="box_main">
<div class="box_main_content inputWithIcon">
<div class="box_title"><i class="material-icons">login</i>Přihlášení</div>
<div class="box_main_content_data ">
<form method="post">
<div class="inputWithIcon">
<input
type="text"
name="name"
placeholder="Přihlašovací jméno nebo E-mail"
required
/><i class="material-icons">person</i>
</div>
<div class="inputWithIcon">
<input
type="password"
name="password"
placeholder="Heslo"
onkeyup="lettersOnly(this)"
required
/><i class="material-icons">lock</i>
</div>
<br /><button name="btn_login">Přihlásit se</button>
</form>
<div class="lost_pass">
<button name="btn_login">Zapomenuté heslo?</button>
</div>
</div>
</div>
<div class="box_main_content inputWithIcon">
<div class="box_title">
<i class="material-icons">person_add</i>Regsitrace
</div>
<div class="box_main_content_data ">
<form method="post">
<div class="inputWithIcon">
<input
type="text"
name="name"
placeholder="Přihlašovací jméno"
onkeyup="lettersOnly(this)"
required
/><i class="material-icons">person</i>
</div>
<div class="inputWithIcon">
<input
type="password"
name="password"
placeholder="Heslo"
onkeyup="lettersOnly(this)"
required
/><i class="material-icons">lock</i>
</div>
<div class="inputWithIcon">
<input
type="password"
name="password_repeat"
placeholder="Heslo znovu"
onkeyup="lettersOnly(this)"
required
/><i class="material-icons">lock</i>
</div>
<div class="inputWithIcon">
<input
class="inputWithIcon"
type="text"
name="email"
placeholder="E-Mail"
required
/><i class="material-icons">email</i>
</div>
<div class="inputWithIcon">
<input
type="text"
name="firstname"
placeholder="Jméno"
/><i class="material-icons">badge</i>
</div>
<div class="inputWithIcon">
<input type="text" name="surname" placeholder="Příjmení" /><i
class="material-icons"
>badge</i
>
</div>
<div class="inputWithIcon">
<input class="inputWithIcon" type="date" name="age" /><i
class="material-icons"
>badge</i
>
</div>
<div class="inputWithIconLabel">
<label class="radio-checkbox inputWithIcon">
<input type="radio" name="sex" value="0" checked /><i
class="material-icons"
>male</i
>
<span class="checkmark"></span>
</label>
<label class="radio-checkbox inputWithIcon">
<input type="radio" name="sex" value="1" />
<i class="material-icons">female</i>
<span class="checkmark"></span>
</label>
</div>
</form>
</div>
</div>
</div>
I am trying to create two drop-down select box in my page..But something happening wrong ..when I run the code, the button bellow and the footer section get vanished.I tried by making height larger but nothing ...again when i remove the select box's code the page load properly with the register button and footer section...For more clearance an image is given bellow.The whole code is under a form..and the form is under a div name maincontent..I have given the css of the maincontent
here is my code
`.maincontent {
margin-top: 200px;
background: #E0E0E0;
float: left;
border: 1px solid #013A57;
padding: 3px 2px;
margin-top: 0px;
border-radius: 5px;
height: 750pxmain;
width: 900px;
margin-left: 15px;
height: 750px;
}
.maincontent table{
height: 20%;
overflow-y: scroll;
width: 55%;
margin-top: 30px;
margin-left: 30px
}
.maincontent tr{
background: #E0E0E0;
border-bottom: 1px solid #FFF;
margin-bottom: 5px;
}
.maincontent td{
font-family: 'Lato', sans-serif;
font-weight: bold;
padding: 10px;
text-align: left;
width: 33.3333%;
font-size: 12px;
}
.maincontent h3{
padding: 10px;
border-bottom: 2px solid #013A57;
margin: 10px;
font-size: 23px;
color: #013A57;
}`
<div class="maincontent" style="">
<h3>Register Here</h3>
<div class="row justify-content-center" style="float: left;margin-left:
2px;margin-top: 50px">
<div class="col" style="width: 200px">
<?php if(!empty($msg)) { ?>
div id="dialog" title="" style="background: #013A57; color: white;">
<?php echo $msg;?>
</div>
<?php }?>
<form method="post" action="register.php" enctype="multipart/form- data"
style="width: 860px;margin: 0px;height: 580px;">
<input class="form-control" type="" name="name" placeholder="Name..."
style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="email" name="email"
placeholder="Email..." style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="password" name="password"
placeholder="Password" style="width: 400px; margin-left: 200px" ><br>
<input class="form-control" type="password" name="cPassword"
placeholder="confirm Password..." style="width: 400px; margin-left: 200px"
><br>
<input class="form-control" type="text" name="contactNO" placeholder="Your
contact No.." style="width: 400px; margin-left: 200px" ><br>
<div class="radio">
<h6>Select a Category</h6>
<input type="radio" name="category" value="customer">Customer<br>
<input type="radio" name="category" value="DispensaryOwner">Dispensary
Owner<br>
<input type="radio" name="category" value="dealer">Dealer<br>
</div>
<br>
<div class="address radio" >
<h6 style="margin-left: 20px">Address</h6>
<select name="district" id="district">
<option value="">Select District</option>
<?php echo load_district(); ?>
</select>
<br>
<select name="place" id="place">
<option value="">Select place</option>
</select>
</div>
<br>
<input class="btn-primary" type="submit" name="submit" value="Register"
style=" margin-left: 200px"><br><br>
</form>
</div>
</div>
</div>
Image Before
Image After
I want to design the responsive contact form where the layout is name, email, subject fields be in one column and message field be in the another column. I could not make that message field appear in another column though I have used the width as 50%. Here is the demo
http://jsbin.com/vuxojuqeve/edit?html,css,output
The code
#responsive-form {
max-width: 600px;
margin: 0 auto;
width: 100%;
}
.form-row {
width: 100%;
}
.form-row input {
margin: 10px 0;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
.button {
float: left;
background: #CA0002;
color: #fff;
text-transform: uppercase;
border: none;
padding: 8px 20px;
cursor: pointer;
}
input[type="text"],
textarea {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 3px;
box-sizing: border-box
}
.half-size {
width: 50%;
}
<div id="responsive-form" class="clearfix">
<div class="half-size">
<div class="form-row">
<div class="column">
<input type="text" name="name" class="form-control">
</div>
</div>
<div class="form-row">
<div class="column">
<input type="text" name="name" class="form-control">
</div>
</div>
<div class="form-row">
<div class="column">
<input type="text" name="name" class="form-control">
</div>
</div>
<div class="form-row">
<div class="column">
<input type="text" name="name" class="form-control">
</div>
</div>
</div>
<div class="half-size">
<div class="form-row">
<div class="column">
<textarea class="form-control" cols="40" rows="10"></textarea>
</div>
</div>
</div>
<div class="form-row">
<div class="column">
<input type="submit" name="name" class="button">
</div>
</div>
</div>
</div>
This is what I wanted with submit button on the left column
You need to set your containers to display:inline-block, as they are block level elements by default and won't allow others to be positioned beside them.
I'm using 45% because 50% + 50% is not usually 100% when using inline-blocks because of an issue with whitespace, there are some ways around it, I'll let you decide for yourself which hack to use...
#responsive-form {
max-width: 600px;
margin: 0 auto;
width: 100%;
}
.form-row {
width: 100%;
}
.form-row input {
margin: 10px 0;
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
.button {
float: left;
background: #CA0002;
color: #fff;
text-transform: uppercase;
border: none;
padding: 8px 20px;
cursor: pointer;
}
input[type="text"],
textarea {
width: 100%;
padding: 8px;
border: 1px solid #ccc;
border-radius: 3px;
box-sizing: border-box
}
.half-size {
width: 45%;
display:inline-block;
}
<div id="responsive-form" class="clearfix">
<div class="half-size">
<div class="form-row">
<div class="column">
<input type="text" name="name" class="form-control">
</div>
</div>
<div class="form-row">
<div class="column">
<input type="text" name="name" class="form-control">
</div>
</div>
<div class="form-row">
<div class="column">
<input type="text" name="name" class="form-control">
</div>
</div>
<div class="form-row">
<div class="column">
<input type="text" name="name" class="form-control">
</div>
</div>
</div>
<div class="half-size">
<div class="form-row">
<div class="column">
<textarea class="form-control" cols="40" rows="10"></textarea>
</div>
</div>
</div>
<div class="form-row">
<div class="column">
<input type="submit" name="name" class="button">
</div>
</div>
</div>
</div>
If there are columns, use flexbox.
Inputs and textarea width unit is vw and e.g. min-width: 180px.
Example
body {
margin: 0;
}
::placeholder,
input[type="submit"] {
color: #BACEE7;
font-weight: bold;
}
.form {
display: flex;
justify-content: center;
padding: 15px;
}
.form input,
.form textarea {
min-width: 180px;
background: #F2F2F2;
border: 1px solid #ccc;
text-transform: uppercase;
border-radius: 3px;
text-align: center;
box-sizing: border-box;
}
.form>.inputs {
margin-right: 5px;
}
.form>.inputs>input {
width: 30vw;
display: block;
margin-bottom: 5px;
padding: 1.5vw;
}
.form>.inputs>input:last-child {
margin-bottom: 0 !important;
}
.form textarea {
width: 35vw;
padding-top: 80px;
display: block;
height: 100%;
}
.form input[type="submit"] {
background: #CA0002;
color: white;
border: none;
cursor: pointer;
}
<div class="form">
<div class="inputs">
<input type="text" name="first_name" placeholder="first name">
<input type="text" name="last_name" placeholder="last name">
<input type="email" name="email" placeholder="email">
<input type="text" name="organization" placeholder="organization">
<input type="tel" name="phone" placeholder="phone">
<input type="submit" name="submit">
</div>
<div class="textarea">
<textarea name="" id="" cols="30" placeholder="message"></textarea>
</div>
</div>
I have created a MailChimp form for the footer of my website, I have modified the CSS with a bit of help to get it looking how it does now. I've become stuck now I attached two images the first one is how I want the form to look and the second one is what the current code makes it look like.
Some help to point me in the right direction would be greatly appreciated.
<div class="row">
<div class="mc-field-group col-lg-6">
<label for="mce-FNAME">First Name:<span class="asterisk"></span></label>
<input type="text" value="" name="FNAME" class="input required" id="mce-FNAME">
</div>
<div class="mc-field-group col-lg-6">
<label for="mce-LNAME">Last Name:<span class="asterisk"></span></label>
<input type="text" value="" name="LNAME" class="input required" id="mce-LNAME">
</div>
</div><!--row-->
<div class="row">
<div class="mc-field-group col-lg-8">
<label class="label" for="mce-EMAIL">Email Address<span class="asterisk"></span></label>
<input type="email" value="" name="EMAIL" class="required input email" id="mce-EMAIL">
</div>
<div class="col-lg-4">
<input type="submit" value="Submit" name="subscribe" id="mc-embedded-subscribe" class="button">
</div>
</div><!--row—>
.mc4wp-form .input {
margin: 10px 0;
float: left;
width: 100%;
line-height: 25px;
border: 1px solid #000;
border-radius: 10px;
}
.mc4wp-form .input:focus,
.mc4wp-form .button:focus {
outline: none;
}
.mc4wp-form .button {
color:#ffffff;
margin-top: 34px;
display: block;
width: 100%;
background: #2451f4;
height: 30px;
font-size: 15px;
border-radius: 10px;
outline: none;
-webkit-transition: all 0.35s ease;
-moz-transition: all 0.35s ease;
-o-transition: all 0.35s ease;
transition: all 0.35s ease;
}
.mc4wp-form .button:hover {
cursor: pointer;
background: #000;
color: #fff;
}
.mc4wp-form {
width: 100%;
max-width: 470px;
}
.mc4wp-form .mc-field-group label {
display: block;
font-size: 22px;
}
.mc4wp-form .row {
display: block;
float: left;
width: 100%;
}
.mc4wp-form .col-lg-6,
.mc4wp-form .col-lg-8,
.mc4wp-form .col-lg-4 {
float: left;
padding: 12px;
box-sizing: border-box;
}
.mc4wp-form .col-lg-6 {
width: 50%;
}
.mc4wp-form .col-lg-8 {
width: 80%;
}
.mc4wp-form .col-lg-4 {
width: 20%;
}
The "Email Address" label has a class of "label" while the other labels do not. Simply delete this class and it will look like the other two.
Find this line:
<label for="mce-EMAIL" class="label">Email Address:</label>
Change it to this:
<label for="mce-EMAIL">Email Address:</label>
Where to find it:
<form action="https://www.kayakinguk.com/" method="post"><div class="mc-field-group col-lg-6">
<label for="mce-FNAME">First Name:</label>
<input type="text" id="mce-FNAME" class="input required" name="FNAME" value="">
</div>
<div class="mc-field-group col-lg-6">
<label for="mce-LNAME">Last Name:</label>
<input type="text" id="mce-LNAME" class="input required" name="LNAME" value="">
</div>
<div class="mc-field-group col-lg-8">
<label for="mce-EMAIL" class="label">Email Address:</label>
<input type="email" id="mce-EMAIL" class="required input email" name="EMAIL" value="">
</div>
The .label class that's changing its background color and font properties is a preset found in bootstrap.css on line 5494 in case you're curious.
I'm looking for the best way to go about a side by side form.
I've done mine in a responsive grid which apparently isn't viable as I am using two separate form tags.
Here is what I've come up with so far.
http://jsfiddle.net/pentester/aFP68/
Any Help Would be greatly appreciated.
<div class="section group">
<div class="col span_1_of_2">
<div class="formwrap">
<form method="post" action="contact.php">
<input type="text" name="name" id="name" placeholder="Name" required />
<input type="text" name="company" id="company" placeholder="Company" required />
<input type="text" name="email" id="email" placeholder="Email" required />
<input type="text" name="phone" id="phone" placeholder="Phone Number" required />
<p class="submit">
<input id="submit" name="submit" type="submit" value="Send" />
</p>
</form>
</div>
</div>
<div class="col span_1_of_2">
<div class="formwrap">
<form method="post" action="contact.php">
<select name="new_or_upgrade" id="new_or_upgrade" placeholder="Type of website">
<option value="Type">Type of website</option>
<option value="normal">Normal</option>
<option value="cms">Content Management Site</option>
<option value="upgrade">E Commerce</option>
</select>
<textarea name="message" placeholder="Tell us about your project" required /></textarea>
</form>
</div>
</div>
/*Form*/
select{
width:100%;
padding:0.5em;
border:1px solid #F2F2F2;
margin-top: 0.5em;}
.formwrap {
margin: auto;
max-width: 70em;
padding: 0 0.5em;
}
.formwrap p {
font-family: sans;
font-weight: 100;
font-size: 1em;
margin: 0;
}
form {
clear: both;
float: left;
width: 100%;
margin: 0 auto;
}
input,
textarea {
padding: 10px;
border: 1px solid #EFEFEF;
width: 100%;
color: #000;
margin-top: 0.5em;
border-radius:3px;
}
textarea {
width: 100%;
height: 150px;
line-height: 18px;
}
input:focus,
textarea:focus {
border: 1px solid #21ABD3;
transition: all 0.2s ease;
}
form label {
margin-left: 1em;
color: #000;
}
.submit input {
background-color: #1D8FBB;
width: 6em;
color: #FFF;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset;
border: none;
float: left;
transition: none;
border-radius: 3px;
font-family:opensans
}
.submit input:hover {
background-color: #34A2CD;
transition: all 0.2s ease;
}
.submit input:active {
box-shadow: 0 0 3px rgba(51, 51, 51, 0.61) inset;
}
/* SECTIONS */
.section {
clear: both;
padding: 0px;
margin: 0px;
}
/* COLUMN SETUP */
.col {
display: block;
float: left;
margin: 1% 0 1% 1%;
}
.col:first-child {
margin-left: 0;
}
/* GROUPING */
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1; /* For IE 6/7 */
}
/* GRID OF TWO */
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 49.5%;
}
/* GO FULL WIDTH AT LESS THAN 600 PIXELS */
#media only screen and (max-width: 800px) {
.col {
margin: 0;
}
}
#media only screen and (max-width: 800px) {
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 100%;
}
}
#media only screen and (max-width: 600px) {
.block{
padding:0.5em 1em}
}
There are a lot of way to create responsive layout. For me, I would like to use Bootstrap.
http://jsfiddle.net/wrcuv/
Here is the example,
<link rel="stylesheet" type="text/css" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" />
<div class="container">
<form method="post" action="contact.php" class="form">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<input type="text" name="name" id="name" placeholder="Name" class="form-control" required />
</div>
<div class="form-group">
<input type="text" name="company" id="company" placeholder="Company" class="form-control" required />
</div>
<div class="form-group">
<input type="text" name="email" id="email" placeholder="Email" class="form-control" required />
</div>
<div class="form-group">
<input type="text" name="phone" id="phone" placeholder="Phone Number" class="form-control" required />
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<select name="new_or_upgrade" id="new_or_upgrade" class="form-control" placeholder="Type of website">
<option value="Type">Type of website</option>
<option value="normal">Normal</option>
<option value="cms">Content Management Site</option>
<option value="upgrade">E Commerce</option>
</select>
</div>
<div class="form-group">
<textarea name="message" placeholder="Tell us about your project" class="form-control" required /></textarea>
</div>
</div>
</div>
<div class="row text-center">
<input id="submit" name="submit" type="submit" value="Send" class="btn btn-primary" />
</div>
</form>
</div>