Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Div not formatting correctly in IE, but looks great in Firefox 1

Status
Not open for further replies.

jfarmerjr

Programmer
Mar 10, 2010
21
US
In Firefox, the inputs line up in the columns of 4, but IE just shows everything in 1 column. How can I get it to look right in both?

Here's the html:

Code:
<html>

<head>
<script type="text/javascript" >
var counter=0;

function createDiv()
{
	var divTag = document.createElement("div");
	var mydiv = document.getElementById("empBigDiv");
        
//	divTag.setAttribute("align","center");
        
	divTag.style.margin = "0px auto";
        
	divTag.className ="dynamicDiv";
        
	divTag.innerHTML = "<div class=\"group\"><label for=\"Ename\">Company Name: </label><br><input type=\"text\" name=\"Ename[" + counter + "]\" size=\"25\"></div>  <div class=\"group\"><label for=\"Eaddress\">Address: </label><br><input type=\"text\" name=\"Eaddress[" + counter + "]\" size=\"25\"></div>&nbsp;<div class=\"group\"><label for=\"Ephone\">Phone #: </label><br><input type=\"text\" name=\"Ephone[" + counter + "]\" size=\"25\"></div><br> <div class=\"group\"><label for=\"Eposition\">Position: </label><br><input type=\"text\" name=\"Eposition[" + counter + "]\" size=\"25\"></div>";
	divTag.innerHTML += "&nbsp;<div class=\"group\"><label for=\"Esupervisor\">Supervisor: </label><br><input type=\"text\" name=\"Esupervisor[" + counter + "]\" size=\"25\"></div>&nbsp;<div class=\"group\"> <label for=\"Ereason\">Reason for Leaving: </label><br><input type=\"text\" name=\"Ereason[" + counter + "]\" size=\"25\"></div> <br> <div class=\"group\"><label for=\"Efrom\">Employed From: </label><br><input type=\"text\" name=\"Efrom[" + counter + "]\" size=\"25\"></div>&nbsp;<div class=\"group\"> <label for=\"Eto\">Employed To: </label><br><input type=\"text\" name=\"Eto[" + counter + "]\" size=\"25\"></div>&nbsp;";
   divTag.innerHTML += "<div class=\"group\"><label for=\"Eequipdriven\">Type of Equipment driven: </label><br><input type=\"text\" name=\"Eequipdriven[" + counter + "]\" size=\"25\"></div><br><div class=\"group\"><label for=\"GapFrom\">Gap in Employment From: </label><br><input type=\"text\" name=\"GapFrom[" + counter + "]\" size=\"25\"></div>&nbsp;<div class=\"group\"><label for=\"GapTo\">To: </label><br><input type=\"text\" name=\"GapTo[" + counter + "]\" size=\"25\"></div>&nbsp;<div class=\"group\"><label for=\"GapReason\">Explain Gap in Employment:</label><br><input type=\"text\" name=\"[" + counter + "]\" size=\"25\"></div><br><br>";
   divTag.innerHTML += "A. FMCSR 391.21 (b)(10) (iv) (A) Were you subject to the Federal Motor Carrier Safety Regulations (FMCSR's) while employed by this previous employer? Yes <input type=\"radio\" name=\"FMCSRsub[" + counter + "]\" value=\"yes\">No<input type=\"radio\" name=\"FMCSRsub[" + counter + "]\" value=\"no\"><br><br>";
   divTag.innerHTML += "B. FMCSR 391.21 (b)(10) (iv) Was this job designated as a safety sensitive function in any DOT regulated mode subject to alcohol and controlled substances testing required by 49 CFR part 40? Yes <input type=\"radio\" name=\"FMCSRtest[" + counter + "]\" value=\"yes\">No<input type=\"radio\" name=\"FMCSRtest[" + counter + "]\" value=\"no\">";
 	counter++;
	mydiv.appendChild(divTag);
}



</script>
<title>HDS Online Application</title>
<link rel="stylesheet" type="text/css" href="app2.css" />
</head>

<body>



<h4>Thank you for choosing to Apply with HDS!</h4>

<form name="app1" method="POST" action="empdivcheck.php">
<fieldset style="width: 850px;">
<legend><b>Employment History</b></legend>

<div class="form-auto" id="empBigDiv">
<p>
<input type="button" value="Add Employer" onclick="createDiv();" />
<input type="Submit" value="Next">


</p>



</div>
</fieldset>

</form>


</body>

</html>

and here's the CSS:

Code:
.form-auto {
padding-left:20px;
float: left;	
}
.dynamicDiv {
width:700px;
height:240px;
border:solid 1px #c0c0c0;
background-color:#e1e1e1;
font-size:11px;
font-family:verdana;
color:#000;
padding:5px;
margin-top: 10px;
}
.group{
display: inline-block;
}

Thanks
 
Nevermind, I forgot to add a doctype. Adding the doctype fixed the problem.
 
You don't have a doctype. Without it, IE goes into quirks mode, and there's no way to predict its rendering. Add a doctype, and it should display like the other browsers.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
guess I took too long.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Thanks for the reply! It was actually your reply to another thread that made me double check it, so you still get credit it my book.
 
Thanks.

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top