Posted by Ben C on 06/17/07 08:44
On 2007-06-17, Jon Slaughter <Jon_Slaughter@Hotmail.com> wrote:
>
> A php comments app that I'm trying to finish up on is at
>
> http://www.abstractdissonance.com/PageComments.php
>
> I'm having trouble styling the divs so that I can fix the width of the
> comments but keep the right width justified instead of staggered as it is.
> (or atleast its staggered in FF but not in IE)
In your style sheet (Comments.css) delete "position: relative" and
change "left: 50px" to "margin-left: 50px".
Relative positioning just offsets things from their normal flow
positions. So they would have lined up before you offset them, and
therefore not afterwards.
See CSS 2.1 10.3 for how widths are calculated. Basically in most cases
the properties you leave as auto get whatever values they need to fill
up the containing width. So if you increase the left margin the computed
value of width gets smaller so it all still fits.
But relative offsets are not taken into account in these calculations.
Everything in 10.3 is done first, and then things are translated by
their relative offsets at the end. This is explained in 9.3.1.
[Back to original message]
|