Creation of two select box under a form - html

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

Related

How do I center the label and input of this form?

I'm new to HTML/CSS and had some questions about my CodeCamp project
How do I move the label and input to the center of the form? I've tried using text-align: center on my row class but it only separates the label and input.
Why are the checkboxes not grouped together? I've tried expanding the bottom margin but it brings the checkboxes on the left column where the labels are supposed to be.
html {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: 'Nunito', sans-serif;
background-color: #ea8a8a;
}
#title {
color: #685454;
text-align: center;
padding: 10px;
}
#description {
color: #685454;
text-align: center;
padding: 10px;
}
#outer-form {
border-radius: 10px;
background-color: #ebd5d5;
padding-bottom: 10px;
}
.row {}
.label {
color: #685454;
display: inline-block;
text-align: right;
float: left;
padding-top: 5px;
width: 190px;
margin-right: 20px;
}
#name {
padding: 4px;
margin-top: 5px;
margin-bottom: 5px;
display: inline-block;
vertical-align: middle;
margin-left: 20px;
width: 110px;
}
#email {
padding: 4px;
margin-top: 5px;
margin-bottom: 5px;
display: inline-block;
vertical-align: middle;
margin-left: 20px;
width: 110px
}
#number {
padding: 4px;
margin-top: 5px;
margin-bottom: 5px;
display: inline-block;
vertical-align: middle;
margin-left: 20px;
width: 110px
}
#dropdown {
height: 30px;
margin-top: 5px;
margin-bottom: 14px;
display: inline-block;
vertical-align: middle;
horizontal-align: bottom;
margin-left: 20px;
width: 120px
}
input[type=radio] {
margin-left: 20px;
margin-bottom: 30px;
vertical-align: baseline;
margin-top: 20px;
}
input[type=checkbox] {
margin-left: 20px;
vertical-align: baseline;
}
#comments {
margin-top: 10px;
margin-bottom: 5px;
vertical-align: middle;
margin-left: 20px;
width: 150px;
height: 50px;
}
#submit {
background-color: #ea8a8a;
color: white;
border-radius: 5px;
font-size: 14px;
margin-top: 10px;
margin-bottom: 20px;
display: inline-block;
vertical-align: middle;
margin-left: 160px;
width: 100px;
height: 40px;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:400,700">
<h1 id="title">Doge Adoption Form</h1>
<div id="outer-form">
<p id="description">Please fill out the questionare below</p>
<form id="survey-form">
<div class="row">
<label class="label" id="name-label" for="name">Name: </label>
<input id="name" placeholder="Enter your name" required> </input>
</div>
<div class="row">
<label class="label" id="email-label" for="email">Email: </label>
<input id="email" type="email" placeholder="Enter your email" required> </input>
</div>
<div class="row">
<label class="label" id="number-label" for="age">Age: </label>
<input id="number" min="18" max="99" type="number" placeholder="Age:" required> </input>
</div>
<div class="row">
<text class="label">What is your favorite dog: </text>
<select id="dropdown">
<option value="Pomeranian"> Pomeranian</option>
<option value="Beagle"> Beagle</option>
<option value="German Shepard"> German Shepard</option>
</select>
</div>
<div class="row">
<label class="label">How likely are you to pick up doge poop:</label>
<input type="radio" name="odds" value="very likely"> Very Likely
<input type="radio" name="odds" value="not likely"> Not Likely
</div>
<div class="row">
<label class="label"> What tricks will you teach (select all that apply)</label>
<input type="checkbox" name="trick" value="Sit">Sit<br>
<input type="checkbox" name="trick" value="Army crawl">Army crawl<br>
<input type="checkbox" name="trick" value="Roll over">Roll over<br>
<input type="checkbox" name="trick" value="Speak">Speak<br>
</div>
<div class="row">
<label class="label">Any additional information?</label>
<textarea id="comments" placeholder="Enter your comment here..."></textarea>
</div>
<div class="row">
<input id="submit" type="submit" value="Submit">
</div>
</form>
</div>
Look at this answer, I have added two styles in your page:
#survey-form {
width: 100%;
max-width: 400px;
margin: 0 auto;
}
.div50 {
float: left;
width: 50%;
}
#survey-form for make the form alignment into center.
.div50 is to divide div as 50% of the parent div.
{
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
body {
font-family: 'Nunito', sans-serif;
background-color: #ea8a8a;
}
#title {
color: #685454;
text-align: center;
padding: 10px;
}
#description {
color: #685454;
text-align: center;
padding: 10px;
}
#outer-form {
border-radius: 10px;
background-color: #ebd5d5;
padding-bottom: 10px;
}
.row {}
.label {
color: #685454;
display: inline-block;
text-align: right;
float: left;
padding-top: 5px;
width: 190px;
margin-right: 20px;
}
#name {
padding: 4px;
margin-top: 5px;
margin-bottom: 5px;
display: inline-block;
vertical-align: middle;
margin-left: 20px;
width: 110px;
}
#email {
padding: 4px;
margin-top: 5px;
margin-bottom: 5px;
display: inline-block;
vertical-align: middle;
margin-left: 20px;
width: 110px
}
#number {
padding: 4px;
margin-top: 5px;
margin-bottom: 5px;
display: inline-block;
vertical-align: middle;
margin-left: 20px;
width: 110px
}
#dropdown {
height: 30px;
margin-top: 5px;
margin-bottom: 14px;
display: inline-block;
vertical-align: middle;
horizontal-align: bottom;
margin-left: 20px;
width: 120px
}
input[type=radio] {
margin-left: 30px;
margin-bottom: 15px;
vertical-align: baseline;
margin-top: 10px;
}
input[type=checkbox] {
margin-left: 30px;
vertical-align: baseline;
}
#comments {
margin-top: 10px;
margin-bottom: 5px;
vertical-align: middle;
margin-left: 20px;
width: 150px;
height: 50px;
}
#submit {
background-color: #ea8a8a;
color: white;
border-radius: 5px;
font-size: 14px;
margin-top: 10px;
margin-bottom: 20px;
display: inline-block;
vertical-align: middle;
margin-left: 160px;
width: 100px;
height: 40px;
}
#survey-form {
width: 100%;
max-width: 400px;
margin: 0 auto;
}
.div50 {
float: left;
width: 50%;
}
<script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:400,700">
<h1 id="title">Doge Adoption Form</h1>
<div id="outer-form">
<p id="description">Please fill out the questionare below</p>
<form id="survey-form">
<div class="row">
<label class="label" id="name-label" for="name">Name: </label>
<input id="name" placeholder="Enter your name" required>
</div>
<div class="row">
<label class="label" id="email-label" for="email">Email: </label>
<input id="email" type="email" placeholder="Enter your email" required>
</div>
<div class="row">
<label class="label" id="number-label" for="age">Age: </label>
<input id="number" min="18" max="99" type="number" placeholder="Age:" required>
</div>
<div class="row">
<text class="label">What is your favorite dog: </text>
<select id="dropdown">
<option value="Pomeranian"> Pomeranian</option>
<option value="Beagle"> Beagle</option>
<option value="German Shepard"> German Shepard</option>
</select>
</div>
<div class="row">
<div class="div50"><label class="label">How likely are you to pick up doge poop:</label></div>
<div class="div50">
<input type="radio" name="odds" value="very likely"> <label>Very Likely</label><br>
<input type="radio" name="odds" value="not likely"> <label>Not Likely</label>
</div>
</div>
<div class="row">
<div class="div50">
<label class="label"> What tricks will you teach (select all that apply)</label>
</div>
<div class="div50">
<input type="checkbox" name="trick" value="Sit">Sit<br>
<input type="checkbox" name="trick" value="Army crawl">Army crawl<br>
<input type="checkbox" name="trick" value="Roll over">Roll over<br>
<input type="checkbox" name="trick" value="Speak">Speak<br>
</div>
</div>
<div class="row">
<label class="label">Any additional information?</label>
<textarea id="comments" placeholder="Enter your comment here..."></textarea>
</div>
<div class="row">
<input id="submit" type="submit" value="Submit">
</div>
</form>
</div>
here is the code for u first of all a neat and clear alignment of a form you should write the code using bootstarp.
put this links also for working the code dear.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Signingroup Financial</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css" type="text/css">
<link rel='stylesheet' href='http://fonts.googleapis.com/icon?family=Material+Icons' type='text/css'>
<link href="http://fonts.googleapis.com/css?family=PT+Sans+Narrow:400,700" rel="stylesheet" type="text/css">
<div class="row">
<div class="sg_formslist">
<div class="col-sm-12 col-md-12">
<div id="Selection-1-container" >
<form class="form-horizontal" id="form1">
<div class="col-sm-12 ">
<div class="col-sm-2">
</div>
<div class="col-sm-6">
<div class="form-group">
<div class="col-sm-12">
<label class="control-label col-sm-6">Surname<span class="impstar">*</span></label>
<div class="col-sm-6">
<input type="text" class="form-control" name="customer_name" Placeholder="Customer Name" required>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<label class="control-label col-sm-6">Mobile Number 1<span class="impstar">*</span></label>
<div class="col-sm-6">
<input type="tel" name="mob_num1" class="form-control" size="10" maxlength="10" Placeholder="+91 - 83445839284" required>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<label class="control-label col-sm-6">Mobile Number 2<span class="impstar">*</span></label>
<div class="col-sm-6">
<input type="tel" name="mob_num1" class="form-control" size="10" maxlength="10" Placeholder="+91 - 83445839284 ">
</div>
</div>
</div>
<div class="form-group ">
<div class="col-sm-12">
<label class="control-label col-sm-6">Gender<span class="impstar">*</span></label>
<div class="col-sm-6">
<div class="radio" required>
<label >
<input type="radio" name="Selection" id="Selection-1" value="female" checked>
Female
</label>
<label >
<input type="radio" name="Selection" id="Selection-1" value="male" >
Male
</label>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-12">
<label class="control-label col-sm-6">Description <span class="impstar">*</span></label>
<div class="col-sm-6">
<textarea class="form-control" rows="3" name="description" placeholder="Description For Discount"></textarea>
</div>
</div>
</div>
<div class="form-group text-right">
<i class="fa fa-paper-plane plnay" ></i>
<input type="submit" class="btn btn-info" value="Submit ">
</div>
</div>
<div class="col-sm-3">
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
let you try this code its working.

CSS footer positioning

Problem is that the footer's text is left aligned on this page but not on any others using identical code. I went step by step commenting out each section and it is the map img that is causing this issue. I can solve this by setting the footer to clear right but that seems to completely mess up the height of the footer. I have included a couple of screen prints to help demonstrate what I mean.
#container {
background-image: url(..//Images/backgroundPic.jpg);
background-repeat: no-repeat;
margin-left: auto;
margin-right: auto;
width: 1000px;
border-style: ridge;
border-width: 5px;
}
h1,
h2 {
text-decoration: underline;
}
p {
font-weight: bold;
}
body {
font-family: Arial, Helvetica, sans-serif;
font-size: medium;
background-color: #F1EBEB;
}
/* Header */
#top {
padding: 0px;
margin: 0px;
background-color: white;
background-image: url(../images/tutorteam.png);
height: 50px;
width: 1000px;
font-size: 1em;
}
#top img {
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
padding-right: 5px;
}
#details {
display: table;
padding: 10px;
}
#details p {
display: table-cell;
vertical-align: top;
padding: 3px;
}
div.tablerow {
display: table-row
}
div.tablerow p:first-child {
text-align: right;
}
#logo {
float: right;
margin-left: 4px;
margin-top: 2px;
}
#back {
float: left;
margin-left: 40px;
margin-top: 2px;
}
#main {
padding: 10px;
margin-top: 20px;
margin-left: 20px;
margin-right: 20px;
background-color: white;
}
#tableContainer {
display: table;
margin-left: auto;
margin-right: auto;
border-spacing: 10px;
font-size: 0.25em;
}
#footer {
display: table-row;
}
#tableCell {
display: table-cell;
vertical-align: top;
}
#dubaiMap {
float: right;
position: relative;
right: 20px;
top: -200px;
}
#signUp {
margin-left: 110px;
margin-bottom: 100px;
border: 0px;
padding: 0px;
height: 90px;
}
#submit {
float: right;
position: relative;
bottom: 60px;
left: 420px;
margin-left: 20px;
background-color: #4CAF50;
/* Green */
border: 2px solid black;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
font-size: 16px;
}
textarea {
float: right;
position: relative;
bottom: 250px;
right: 175px;
border: 3px solid #4CAF50;
font-size: 14px
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Sign Up</title>
<link type="text/css" rel="stylesheet" href="login.css">
</head>
<body>
<div id="container">
<section id="top">
<a href="../index.html">
<img id="back" src="../images/back.png" height="40px">
</a>
<img id="logo" src="../images/tutorTeamLogo.png" height="40px">
</section>
<section id="main">
<p>Are you a tutor or customer? please select the relevant option.</p>
<form>
<select name="user">
<option value="Customer">Customer</option>
<option value="Tutor">Tutor</option>
</select>
</form>
<form action="tutorSignUp.php" method="POST">
<p>Please complete to sign up.</p>
<section id="details">
<div class="tablerow">
<p>First name:</p>
<p>
<input type="text" name="firstName" value="">
</p>
</div>
<div class="tablerow">
<p>Last name:</p>
<p>
<input type="text" name="lastName" value="">
</p>
</div>
<div class="tablerow">
<p>Address:</p>
<p>
<input type="text" name="address" value="">
</p>
</div>
<div class="tablerow">
<p>city:</p>
<p>
<input type="text" name="city" value="">
</p>
</div>
<div class="tablerow">
<p>Zip:</p>
<p>
<input type="text" name="zip" value="">
</p>
</div>
<div class="tablerow">
<p>Telephone:</p>
<p>
<input type="tel" name="telephone" value="">
</p>
</div>
</section>
<img src="../Images/dubaiZones.png" id="dubaiMap">
<p>Tutoring level</p>
<select name="level">
<option value="Pre School">Pre School</option>
<option value="Primary School">Primary</option>
<option value="GCSE">GCSE</option>
<option value="A level">A Level</option>
<option value="Undergraduate">Undergraduate</option>
<option value="Post Graduate">Post Graduate</option>
</select>
<p>Subject specialism(s)</p>
<input type="checkbox" name="subject" value="English">English
<br>
<input type="checkbox" name="subject" value="Maths">Maths
<br>
<input type="checkbox" name="subject" value="Physics">Physics
<br>
<input type="checkbox" name="subject" value="Chemistry">Chemistry
<br>
<input type="checkbox" name="subject" value="Biology">Biology
<br>
<input type="checkbox" name="subject" value="History">History
<br>
<input type="checkbox" name="subject" value="Geography">Geography
<br>
<input type="checkbox" name="subject" value="Religious Studies">R.E.
<br>
<input type="checkbox" name="subject" value="French">French
<br>
<input type="checkbox" name="subject" value="German">German
<br>
<input type="checkbox" name="subject" value="Spanish">Spanish
<br>
<input type="checkbox" name="subject" value="Computing">Computing
<br>
<input type="checkbox" name="subject" value="Business">Business
<br>
<input type="checkbox" name="subject" value="Economics">Economics
<br>
<input type="checkbox" name="subject" value="Classics">Classics
<br>
<br>
<textarea id="textArea" name="comments" rows="10" cols="48">Additional Information...</textarea>
<input type="submit" value="Sign Up" id="submit">
</form>
</section>
<footer>
<table id="tableContainer">
<tr id="footer">
<td id="tableCell">Website design and coding provided by Technology in Learning 2016 Copyright Technology in Learning
<img id="til" src="../Images/company.png" height="12" width="12">
</td>
</tr>
</table>
</footer>
</div>
</body>
</html>
I don't undestand the need of using a table to display a single line of text.
You juste need to use a paragraph with text-align: center;
.text-center {
text-align: center;
}
<footer id="footer">
<p class="text-center">Website design and coding provided by Technology in Learning 2016 Copyright Technology in Learning
<img id="til" src="../Images/company.png" height="12" width="12">
</p>
</footer>
Plus I think your issue is du to the use of the table. I believe by default table cell align text on the left, and I didn't see any CSS rule to change that in your code.

Left Align Series of Text Boxes and Paragraphs

I created a form and I want the content of the form to all be left-aligned. The inputs and paragraphs in the form end up on top of each other when I use float: left; so I am trying to figure out how to properly implement this so they are all neatly stacked on top of one another.
The header is in a perfect position as is. I only want the form to be left aligned.
* {
box-sizing: border-box;
}
body {
background-color: black;
margin-left: 20%;
margin-right: 20%;
margin-top: 3%;
}
button {
background-color: white;
border: none;
color: black;
float: left;
font-family: Gilroy-Bold;
font-size: 57px;
height: 110px;
margin-bottom: 40px;
margin-top: 40px;
width: 300px;
}
button:hover {
background-color: lightgray;
}
form {
float: left;
}
textarea {
float: left;
font-family: Gilroy;
font-size: 25px;
height: 400px;
padding-left: 10px;
padding-top: 5px;
width: 600px;
}
#font-face {
font-family: Gilroy;
color: white;
src: typefaces/gilroy-bold.ttf (gilroy-bold.ttf);
}
form {
font-family: Gilroy;
padding-top: 20px;
padding-bottom: 40px;
}
h1 {
color: white;
font-family: Gilroy-Bold;
font-size: 95px;
margin-bottom: 0px;
margin-top: 0px;
text-align: center;
}
hr {
border: 0;
border-bottom: 1px solid white;
border-top: 12px solid white;
width: 760px;
}
input {
float: left;
font-family: Gilroy;
font-size: 25px;
padding-left: 5px;
height: 50px;
width: 500px;
}
p{
color: white;
float: left;
font-family: Gilroy-Bold;
font-size: 30px;
}
<DOCTYPE! html>
<html>
<head>
<title>1520 Sedgwick Avenue - Sign The Petition</title>
<link href="css/form.css" rel="stylesheet"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="petition.js"></script>
</head>
<body>
<header>
<hr>
<h1>SIGN THE PETITION</h1>
<hr>
</header>
<div class="col-sm-6 col-sm-offset-3">
<form action="petition.php" method="POST">
<p>FIRST NAME</p>
<div id="first-name-group" class="form-group">
<label for="first-name">First Name</label>
<input type="text" class="form-control" name="first-name" placeholder="John">
</div>
<p>LAST NAME</p>
<div id="last-name-group" class="form-group">
<label for="last-name">Last Name</label>
<input type="text" class="form-control" name="last-name" placeholder="Smith">
</div>
<p>EMAIL</p>
<div id="email-group" class="form-group">
<label for="email">Email</label>
<input type="text" class="form-control" name="email" placeholder="jsmith#gmail.com">
</div>
<p>COUNTRY</p>
<div id="country-group" class="form-group">
<label for="country">Country</label>
<input type="text" class="form-control" name="country" placeholder="United States">
</div>
<p>STREET ADDRESS</p>
<div id="street-address-group" class="form-group">
<label for="street-address">Street Address</label>
<input type="text" class="form-control" name="street-address" placeholder="123 Brick Lane">
</div>
<p>ZIP CODE</p>
<div id="zip-code-group" class="form-group">
<label for="zip-code">Zip Code</label>
<input type="text" class="form-control" name="zip-code" placeholder="12345">
</div>
<p>COMMENT (OPTIONAL)</p>
<div id="comment-group" class="form-group">
<label for="comment">Comment</label>
<textarea rows "4" cols = "50" type="text" class="form-control" name="comment" placeholder="I'm signing because..."></textarea>
</div>
<button type="submit" class="btn btn-success">SUBMIT</button>
</form>
</div>
</body>
</html>
Cleared form-group class. Because you are floating the inputs to left. The wrapper of it which is form-group must clear itself so that the next div can come after it.
I also made paragraph tag to take 100% width.
Also note that for refers to the name attribute in the <input> tag in your code. It should refer to the id attribute. [ Mentioned by - Roy_Dorsthorst]
* {
box-sizing: border-box;
}
body {
background-color: black;
margin-left: 20%;
margin-right: 20%;
margin-top: 3%;
}
button {
background-color: white;
border: none;
color: black;
float: left;
font-family: Gilroy-Bold;
font-size: 57px;
height: 110px;
margin-bottom: 40px;
margin-top: 40px;
width: 300px;
}
.form-group:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
button:hover {
background-color: lightgray;
}
form {
float: left;
}
textarea {
float: left;
font-family: Gilroy;
font-size: 25px;
height: 400px;
padding-left: 10px;
padding-top: 5px;
width: 600px;
}
#font-face {
font-family: Gilroy;
color: white;
src: typefaces/gilroy-bold.ttf (gilroy-bold.ttf);
}
form {
font-family: Gilroy;
padding-top: 20px;
padding-bottom: 40px;
}
h1 {
color: white;
font-family: Gilroy-Bold;
font-size: 95px;
margin-bottom: 0px;
margin-top: 0px;
text-align: center;
}
hr {
border: 0;
border-bottom: 1px solid white;
border-top: 12px solid white;
width: 760px;
}
input {
float: left;
font-family: Gilroy;
font-size: 25px;
padding-left: 5px;
height: 50px;
width: 500px;
}
p{
color: white;
float: left;
font-family: Gilroy-Bold;
font-size: 30px;
width: 100%;
}
<DOCTYPE! html>
<html>
<head>
<title>1520 Sedgwick Avenue - Sign The Petition</title>
<link href="css/form.css" rel="stylesheet"/>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="petition.js"></script>
</head>
<body>
<header>
<hr>
<h1>SIGN THE PETITION</h1>
<hr>
</header>
<div class="col-sm-6 col-sm-offset-3">
<form action="petition.php" method="POST">
<p>FIRST NAME</p>
<div id="first-name-group" class="form-group">
<label for="first-name">First Name</label>
<input type="text" class="form-control" id="first-name" name="first-name" placeholder="John">
</div>
<p>LAST NAME</p>
<div id="last-name-group" class="form-group">
<label for="last-name">Last Name</label>
<input type="text" class="form-control" id="last-name" name="last-name" placeholder="Smith">
</div>
<p>EMAIL</p>
<div id="email-group" class="form-group">
<label for="email">Email</label>
<input type="text" class="form-control" id="email" name="email" placeholder="jsmith#gmail.com">
</div>
<p>COUNTRY</p>
<div id="country-group" class="form-group">
<label for="country">Country</label>
<input type="text" class="form-control" id="country" name="country" placeholder="United States">
</div>
<p>STREET ADDRESS</p>
<div id="street-address-group" class="form-group">
<label for="street-address">Street Address</label>
<input type="text" class="form-control" id="street-address" name="street-address" placeholder="123 Brick Lane">
</div>
<p>ZIP CODE</p>
<div id="zip-code-group" class="form-group">
<label for="zip-code">Zip Code</label>
<input type="text" class="form-control" id="zip-code" name="zip-code" placeholder="12345">
</div>
<p>COMMENT (OPTIONAL)</p>
<div id="comment-group" class="form-group">
<label for="comment">Comment</label>
<textarea rows "4" cols = "50" type="text" class="form-control" id="comment" name="comment" placeholder="I'm signing because..."></textarea>
</div>
<button type="submit" class="btn btn-success">SUBMIT</button>
</form>
</div>
</body>
</html>

Input forms not aligning correctly in Safari

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.

How to fit 15 fields into a 400px by 510px form

I'm currently dealing with a form that has many fields, and I am trying to fit them all nicely within a box that is 400px in height and 510px in width. Im pretty noobish when it comes to editing advanced CSS (this is advanced for me).
Would love it if someone could figure this one out for me! I'm not trying to get this done for me, but rather if someone did it or explained how to do it, it would really help me learn how to do it myself.
I do not have access to the html
I'm pulling the stylesheet from another server which I also do not have access to
I need 15 form fields to fit (neatly) within that 400x510px space
CSS:
#qw {
width: 100%;
height: 400px;
background-color: #transparent;
border-radius: 0 0 0px 0px;
padding: 0px;
font: 14px/20px sylfaen, garamond, 'urw palladio l', georgia, serif;
}
#qw #qw_header {
background-image:;
width: 100%;
height: 68px;
}
#qw label {
display: none;
}
#qw fieldset {
border: none;
margin-top: 0px;
padding-top: 0px;
padding-left: 8px;
}
#qw fieldset legend {
visibility: hidden;
}
#qw fieldset input, #qw fieldset select {
width: 93%;
border: 1px solid #bbb;
border-top-color: #777;
border-bottom-color: #ddd;
padding: 4px;
margin-bottom: 4px;
font-size: 16px;
font-family: helvetica, arial, sans-serif;
height: 18px;
}
#qw fieldset select {
height: 28px;
width: 100%;
}
#qw .qw_personal_header {
text-align: center;
}
#qw .qw_personal_header:before {
content:'You';
text-transform: uppercase;
font-size: 16px;
color: #000;
width: 100%;
}
#qw .qw_personal:after {
clear: both;
}
#qw .qw_vehicle_header {
text-align: center;
clear:both;
}
#qw .qw_vehicle_header:before {
clear: both;
font-size: 16px;
content:' Car';
text-transform: uppercase;
color: #000;
width: 100%;
}
#qw .qw_first_name, #qw .qw_last_name, #qw .qw_zip_code, #qw .qw_city, #qw .qw_state, #qw .qw_phone, #qw .qw_email {
float: left;
width: 45%;
margin: 5px;
}
#qw .qw_monthly_income, #qw .qw_vehicle_year, #qw .qw_vehicle_make, #qw .qw_vehicle_model, #qw .qw_vehicle_mileage, #qw .qw_vehicle_owned {
float: right;
width: 45%;
margin: 5px;
}
#qw .qw_vehicle_owned {
width: 93%;
}
#qw .submit {
margin-top: 10px;
text-align: center;
}
#qw .submit input {
background:url cursor:pointer;
height: 46px;
width: 297px !important;
font-size: 0px;
border: none;
}
#qw .qw_legal {
font-size: 12px;
color: #000;
padding-left: 15px;
padding-right: 15px;
line-height: 12px;
}
#qw .qw_legal a {
color: black;
text-decoration:underline;
}
#qw .submit input {
width: 80%;
}
working example: http://jsfiddle.net/awesome/Jbj2h/
using bootstrap 3.1: http://getbootstrap.com
CSS:
.form-box {
width: 510px !important;
height: 400px !important;
overflow: hidden !important;
background-color: White;
display: block;
padding: 5px;
}
body {
background-color: Gainsboro;
}
.form-box .form-group {
margin-bottom: 10px;
}
.form-box textarea {
margin-bottom: 10px;
}
HTML:
<div class="form-box">
<form class="form-horizontal" role="form">
<div class="col-xs-12">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-4">
<div class="form-group">
<label class="sr-only" for="awesome">Awesome</label>
<input type="text" class="form-control input-sm" id="awesome" placeholder="Enter text">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<select class="form-control input-sm">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<select class="form-control input-sm">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
</div>
<textarea class="form-control input-sm" rows="2" placeholder="stuff"></textarea>
<button type="button" class="btn btn-primary btn-block">Go!</button>
</form>
</div>
I find with css fitting things on a form can be a bit tricky. My advice would be to avoid using floats and clearfixes where you can and instead stick to your width=__%
When using the width however one thing that trips me up is that this includes the margin and padding as well, so why it might make sense to have two items side by side at 50%, it doesn't often work out that way.
Another tip I use when doing css like this is to inspect it in the browser using development tools (In most you access this by right clicking and selecting "inspect element"). This way you can modify your css code as much as you like until your happy with it to try it in your code proper, as well as seeing the boundaries of the margins, content and padding.
http://jsfiddle.net/r3gw7/
Concept fiddle, makes use of
overflow-y: scroll;