I am creating a form with input boxes. I want to have a label, followed by an input box, followed by a 2nd label, followed by a 2nd input box, all on one line. I have code which will put one label followed by two input boxes on one line, and the 2nd label appears on the next line. I haven't been able to figure out how to put the 2nd label between the two input boxes. Can anyone show me how to do this?
Basically, what I want to do is have the red hilighted "label" field appear before the green labeled "input" field.
I'm using the following CSS file for the above page, the label format is in red, the input in green:
Code:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en" lang="en-us">
<head>
<title>TEST</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="/css/form.css" />
</head>
<body>
<form name="form1" method="post" action="leads_process_page.php">
<div id="header">
<center>
<h2>XXXXXXXXXXX.net</h2>
<em>PHP Testing</em>
</center>
</div>
<div id="main">
<fieldset><b><em><legend>Lead Information</legend></em></b>
<div class="required">
<label for="company">Company Name:</label>
<input type="text" name="company" id="company" class="inputText" size="25" maxlength="100" value="" />
</div>
<div class="required">
<label for="contact">Contact Name:</label>
<input type="text" name="contact" id="contact" class="inputText" size="25" maxlength="100" value="" />
</div>
<div class="optional">
<label for="street">Address:</label>
<input type="text" name="street" id="street" class="inputText" size="25" maxlength="100" value="" />
</div>
<div class="optional">
<label for="street2">Address2:</label>
<input type="text" name="street2" id="street2" class="inputText" size="25" maxlength="100" value="" />
</div>
<!-- Code between comments is from twoColumn_form.php -->
</fieldset>
</div>
<label for="username">Username:</label>
[b][COLOR=green]<input type="text" name="username" id="username" value="peterv" />[/color][/b]
[b][COLOR=red]<label for="password">Password:</label>[/color][/b]
<input name="password" id="password" value="Password" type="password" />
</form>
</body>
</html>
Basically, what I want to do is have the red hilighted "label" field appear before the green labeled "input" field.
I'm using the following CSS file for the above page, the label format is in red, the input in green:
Code:
@CHARSET "UTF-8";
/* form.css */
* {
margin: 0;
padding: 0;
}
/*
xbody {
font: 100% arial, helvetica, sans-serif;
}
xfieldset {
padding: 0 1em 1em 1em;
}
xlegend {
padding: 1em;
}
*/
form {
margin: 0;
padding: 0;
font-size: 100%;
min-width: 560px;
max-width: 620px;
width: 590px;
}
[b][COLOR=green]form input {
border-color: green;
/* top - right - bottom - left */
border-width: 2px 2px 2px 2px;
border-style: solid solid solid solid;
}[/color][/b]
form fieldset {
clear: both;
font-size: 100%;
color: green;
border-color: orange;
/* top - right - bottom - left */
border-width: 2px 2px 2px 2px;
border-style: solid solid solid solid;
padding: 0;
margin: 0 0 0 0;
}
form fieldset legend {
font-size: 150%;
font-weight: normal;
color: BLUE;
margin: 0 0 0 0;
padding: 0 5px;
/* border will outline the legend. */
border-color: orange;
border-width: 1px 1px 1px 1px;
border-style: solid solid solid solid;
}
/* field label formatting */
label {
font-weight: bold;
float: left;
width: 15em; /* Distance from left margin. */
text-align: right;
clear: left;
margin-right: 15px;
font-size: 100%;
}
input {
/* t-r-b-l */
padding: 0 0 0 0;
margin: 0px 55px 5px 5px;
}
label u {
font-style: normal;
text-decoration: underline;
}
input, select, textarea {
font-family: Tahoma, Arial, sans-serif;
font-size: 75%;
color: blue;
}
option {
color: green;
width: 150px;
}
textarea {
overflow: auto;
}
form div {
clear: left;
display: block;
width: 354px;
zoom: 1;
margin: 5px 5px 5px 5px;
/* margin: 5px 0 0 0; */
padding: 1px 3px;
}
form fieldset div.notes {
float: right;
width: 158px;
height: auto;
margin: 0 0 10px 10px;
padding: 5px;
border: 1px solid #666666;
background-color: #8fffff;
color: #666666;
font-size: 88%;
}
form fieldset div.notes h4 {
background-image: url(/images/icon_info.gif);
background-repeat: no-repeat;
background-position: top left;
padding: 3px 0 3px 27px;
border-width: 0 0 1px 0;
border-style: solid;
border-color: #666666;
color: #666666;
font-size: 110%;
}
form fieldset div.notes p {
margin: 0em 0em 1.2em 0em;
color: #666666;
}
form fieldset div.notes p.last {
margin: 0em;
}
/*form div fieldset {
clear: none;
border-width: 1px;
border-style: solid;
border-color: #666666;
margin: 0 0 0 144px;
padding: 0 5px 5px 5px;
width: 197px;*/
}
form div fieldset {
clear: none;
border-width: 4px;
border-style: solid;
border-color: red;
margin: 0 0 0 144px;
padding: 0 5px 5px 5px;
width: 197px;
}
form div fieldset legend {
font-size: 100%;
padding: 0 3px 0 9px;
}
form div.required fieldset legend {
font-weight: bold;
}
form div label {
font-weight: bold;
display: block;
float: left;
width: 130px;
padding: 3px 5px;
margin: 0 0 5px 0;
text-align: right;
clear: left;
margin-right: 0 0 15px 0;
color: purple;
}
[b][COLOR=red] form label {
font-weight: bold;
display: block;
float: left;
width: 130px;
padding: 0 5px 0 0;
margin: 0px 0px 0px 22px;
/* text-align: right; */
/* clear: left; */
margin-right: 0 0 15px 0;
color: cyan;*/
}[/color][/b]
#tNplabel {
font-weight: bold;
display: block;
float: left;
width: 130px;
/* padding TOP - RIGHT - ? - ? */
padding: 2px 8px;
/* margin LEFT - RIGHT - TOP - BOTTOM */
margin: 0 0 5px 0;
text-align: right;
clear: left;
margin-right: 0 0 15px 0;
color: green;
}
form div.optional label, label.optional {
font-weight: normal;
}
form div.required label, label.required {
font-weight: bold;
}
form div label.labelCheckbox, form div label.labelRadio {
float: none;
display: block;
width: 200px;
zoom: 1;
padding: 0;
margin: 0 0 5px 142px;
text-align: left;
}
form div fieldset label.labelCheckbox, form div fieldset label.labelRadio {
margin: 0 0 5px 0;
width: 170px;
}
form div img {
border: 1px solid #000000;
}
p.error {
background-color: #ff0000;
background-image: url(/images/icon_error.gif);
background-repeat: no-repeat;
background-position: 3px 3px;
color: #ffffff;
padding: 3px 3px 5px 27px;
border: 1px solid #000000;
margin: auto 100px;
}
form div.error {
background-color: #ffffe1;
background-image: url(/images/required_bg.gif);
background-repeat: no-repeat;
background-position: top left;
color: #666666;
border: 1px solid #ff0000;
}
form div.error p.error {
background-image: url(/images/icon_error.gif);
background-position: top left;
background-color: transparent;
border-style: none;
font-size: 88%;
font-weight: bold;
margin: 0 0 0 118px;
width: 200px;
color: #ff0000;
}
form div select, form div textarea {
width: 200px;
padding: 0px 3px;
margin: 0 0 0 0;
}
form div input.inputText, form div input.inputPassword {
width: 200px;
/* padding: 1px 3px; */
padding: 0 0 0 0;
margin: 0 0 0 0;
}
form div input.inputFile {
width: 211px;
}
form div select.selectOne, form div select.selectMultiple {
width: 211px;
padding: 1px 3px;
}
form div input.inputCheckbox, form div input.inputRadio, input.inputCheckbox, input.inputRadio {
display: inline;
height: auto;
width: auto;
background-color: transparent;
border-width: 0;
padding: 0;
margin: 0 0 0 140px;
}
/* div.submit controls the button line */
form div.submit {
width: 294px;
padding: 0 0 0 0;
}
form div.submit div {
display: inline;
float: left;
text-align: left;
clear: left;
width: auto;
padding: 10;
margin: 0;
}
/* Button Formatting */
form div input.inputSubmit, form div input.inputButton, input.inputSubmit, input.inputButton {
background-color: #cccccc;
color: #000000;
width: auto;
padding: 0 6px;
margin: 0;
}
form div.submit div input.inputSubmit, form div.submit div input.inputButton {
float: right;
margin: 0 0 0 5px;
}
form div small {
display: block;
margin: 0 0 5px 142px;
padding: 1px 3px;
font-size: 88%;
zoom: 1;
}
Any and ALL help on this is really appreciated. I've been banging my head against the wall on this for 2 days!