Edit: Ok, this is what works. It may not be "right", but 1) it displays correctly & 2) it validates at W3C. It seems that I should make all positioning absoolute and add positioning to all divs except for those with a fieldset, where I have to add the position to the fieldset. Feel free to correct this if you think that I am wrong, but "it works for me" ! Yay! Yipee! At last! Lots of +1 all round and thanks to all who helped.
Edit: the bounty goes to whomever can post the editted HTML which displays like the Delphi screenshot.
I am using Borland Delphi to produce an HTML form generator. The user can drag & drop components to produce a file and when he is happy he can generate HTML (I pop a Submit button on to the end of his form).
Since I have the absolute position of each control when I am generating, I want so specify absolute positions in CSS. I thought this meant that I have to use position: fixed
, but that doesn't look right, and nor does absolute.
What am I doing wrong? (the HTML validates at W3C)
Here is a very basic basic example as seen when designing the form in the Delphi program
And here it is in MSIE 8 (with fix position)
And again with absolute position
And, finally, here is the HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Input data</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
</head>
<body>
<form action="http://localhost/a_submitted.php" method="post">
<div class="TGroupBox" id="GroupBox1">
<fieldset style="position: absolute; top:40px; left:40px; width: 857px; height: 441px;">
<legend>GroupBox1</legend>
<div class="TPanel" id="Panel1">
<fieldset style="position: absolute; top:64px; left:56px; width: 753px; height: 369px;">
<legend></legend>
<div class="TLabel" id="Label1" style="position: absolute; top:88px; left: 80px; width: 32px; height: 13px;">Label1</div>
<div class="TEdit" id="Edit1" style="position: absolute; top:80px; left: 72px; width: 121px; height: 21px;"><input type="text" name="Edit1" value="an edit bx"></div>
<div class="TCheckBox" id="CheckBox1" style="position: absolute; top:88px; left: 80px; width: 97px; height: 17px;">CheckBox1<input type="checkbox" name="CheckBox1" value="CheckBox1Checked"></div>
<div class="TComboBox" id="ComboBox1" style="position: absolute; top:145px; left: 137px; width: 145px; height: 21px;">
<select size ="1" name="ComboBox1">
<option value="one" selected="selected">one </option>
<option value="two">two </option>
<option value="three">three </option>
</select>
</div>
<div class="TRadioGroup" id="RadioGroup1">
<fieldset style="position: absolute; top:144px; left: 136px; width: 185px; height: 105px;"><legend>RadioGroup1</legend>
red: <input type="radio" name="RadioGroup1" value=""><br>
white: <input type="radio" name="RadioGroup1" value="" checked><br>
blue: <input type="radio" name="RadioGroup1" value=""><br>
</fieldset>
</div>
</fieldset>
</div>
</fieldset>
</div>
<div><input type="submit" name="submitButton" value="Submit" style="position:relative; top:25px; left: 50%;"></div>
</form>
</body>
</html>
Edit: the bounty goes to whomever can post the editted HTML which displays like the Delphi screenshot.
Edit: Ok, this is what works. It may not be "right", but 1) it displays correctly & 2) it validates at W3C. It seems that I should make all positioning absoolute and add positioning to all divs except for those with a fieldset, where I have to add the position to the fieldset. Feel free to correct this if you think that I am wrong, but "it works for me" ! Yay! Yipee! At last! Lots of +1 all round and thanks to all who helped.