PDA

View Full Version : Alignment problems in IE



aspekt9
Apr 10th, 2007, 01:24 AM
Everything displays correctly in Firefox but in IE the stats feed box on the right is oversized and moved outside the container.

koyama
Apr 10th, 2007, 02:24 AM
Everything displays correctly in Firefox but in IE the stats feed box on the right is oversized and moved outside the container.

The problem is with your use of fieldsets and legends:


legend {
margin:-22px 10px;
color: #fff;
background-color:#781351;
border: 1px solid #781351;
padding: 2px 10px;
position:absolute;
}

The reason for different rendering is that you have absolutely positioned the legend, but not specified any offset properties (top, right, bottom, or left). Browsers disagree where to position such elements.

Anyway, you shouldn't be using fieldsets and legends for this purpose. The fieldset should probably be replaced by a paragraph element and the legend with a heading. You can achieve the same effect using borders, negative margins, or perhaps relative positioning while at the same time specifying some offset. Try to do some experiments with this.

aspekt9
Apr 10th, 2007, 02:35 AM
I've done a little playing around and can get the fieldset effect minus the little box where my title is. How would I get that box positioned there?


<div style="border:1px solid #000; margin-top: .5em;">
<h1 style="font-size:125% ; margin:-.5em 0 10px 10px"><span style="background:#FFF ; padding:0 5px">My Title</span></h1>
<p style="margin:10px">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

koyama
Apr 10th, 2007, 02:50 AM
I've done a little playing around and can get the fieldset effect minus the little box where my title is. How would I get that box positioned there?
Not sure what you mean. It looks quite fine. If you mean that you want to get rid of the span element, you could try to float the h1 to get the shrink effect.


<div style="border:1px solid #000; margin-top: .5em;">
<h1 style="float: left; font-size:125% ; margin:-.5em 0 10px 10px; background: red;">My Title</h1>
<p style="margin:10px; clear: left;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
You'll need to test this however.

aspekt9
Apr 10th, 2007, 02:57 AM
I got it I actually just wanted a border around the my title to achieve the legend effect:


<div style="border:1px solid #000; margin-top: .5em;">
<h1 style="font-size:125% ; margin:-.5em 0 10px 10px"><span style="background:#FFF ; padding:0 5px; border:1px solid #000">My Title</span></h1>
<p style="margin:10px">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>

Thanks for all the help :)