tags:

views:

83

answers:

3

Here's the HTML

<div class="panel" id="Panel1">
<fieldset style="position: absolute; top:8px; left: 136px; width: 136px; height: 48px;">
<legend> </legend>
  <div class="label" id="Label1" style="position: absolute; top:8px; left: 16px; width: 81px; height: 14px;">panel one</div>
</fieldset>
</div>

<div class="panel" id="Panel2">
<fieldset style="position: absolute; top:8px; left: 272px; width: 185px; height: 64px;">
<legend> </legend>
  <div class="Label" id="Label3" style="position: absolute; top:8px; left: 64px; width: 64px; height: 14px;">panel two</div>
</div>

and here's the CSS

body {
 background-color: white;
 width: 100%;
}

.panel, Label, .fieldset {
  font: 8px Arial; 
  border: 0px;
  margin: 0px;
  padding: 0px;
}

Panel one has left=136px and width=136px while panel two has left=372px but when I look at them in MS IE 8 they overlap. What gives?


A few points of info

  • Obviously, I am a relative CSS newbie.
  • This is part of a project to design a form in a Windows program and then view it in the browser. It has to be WYSIWYG, which is why I am giving precise coordinates, rather than allowing the browser to lay out the page.
  • But might it be that I would be better off with style="position: fixed; ?
  • I am not sure if I need positioning on both the divs and their contents, but, if only one, then which?
  • I made the example as simple as possible, but it must scale up to multiply nested fieldsets
    • I have no choice but to use MS IE, although I can recommend a (minumum) version.

Thanks in advance for any help

A: 

try putting relative on the surrounding div.

.panel{posistion:relative}

Kieran
I'll try, but it sounds like you want me to leave the style on the fieldset, whereas @Strelok wants me to move it to the div. No wonder i am confsued :-)
LeonixSolutions
+1 btw (Sorry, I forgot to say)
LeonixSolutions
@Kieran Why did you rollback my edit? Your answer is incorrectly formatted (using the `pre` tag doesn't get you code highlighting) and you spelled `position` wrong.
Yi Jiang
@yi jiang y vote me down because i rolled you back. ya ass
Kieran
+2  A: 

Your HTML is incorrect. The style definitions that are on your fieldset element, should be on your div elements for panel 1 and 2. Also your fieldset tag in panel2 is unclosed.

Try this HTML:

<div class="panel" id="Panel1" style="position: absolute; top:8px; left: 136px; width: 136px; height: 48px;">
    <fieldset >
        <legend> </legend>
        <div class="label" id="Label1" style="position: absolute; top:8px; left: 16px; width: 81px; height: 14px;">panel one</div>
    </fieldset>
</div>

<div class="panel" id="Panel2" style="position: absolute; top:8px; left: 272px; width: 185px; height: 64px;">
    <fieldset >
        <legend> </legend>
        <div class="Label" id="Label3" style="position: absolute; top:8px; left: 64px; width: 64px; height: 14px;">panel two</div>
    </fieldset>
</div>​
Strelok
Thanks. Did you try this in MS IE 8? The panels are suddenly only a few pixels high (maybe 8?) with the text below them.
LeonixSolutions
Sorry, I don't have IE8 here at work. Try putting `overflow:auto;` in their style as well.
Strelok
+1 btw (Sorry, I forgot to say)
LeonixSolutions
+1  A: 

As Strelok pointed out, there are mistakes in your HTML. I also notice that your css refers to elements with a class of fieldset did you want that to be on the fieldset itself?

if so, in the css remove the . before .fieldset

Chris J
+1 Thanks, yes, I meant real <fieldset>
LeonixSolutions
Btw, shoudl the styling be on the enclosing div or the fieldset? Should there even be an enslosing div? It's only there for the sytle.
LeonixSolutions
If you don't need the div to group elements not already grouped by the fieldset, you shouldn't need to use that enslosing div.
Chris J