Re: Problems understanding positioning

[ Note:  Questions of this sort should probably be asked on
comp.infosystems.www.authoring.stylesheets rather than www-style. ]

On Wed, 30 Aug 2000 09:45:03 -0700, "Maury Markowitz"
(maury@sympatico.ca) wrote:
> 
>   The nav bar gets positioned absolute as if it's not inside main at =
> all. Now I found a workaround, but the solution baffles me...
> 
> .article { POSITION:relative; }
> 
>   Do that and poof, the nav bar goes where I want it.
> 
>   Ok, but why?  Why should the positioning style of my parent block have =
> any effect whatsoever on the children?

See the rules for determining the containing block of an absolutely
positioned element in section 10.1 of CSS2 [1].  (It might have been
easier if 'absolute' and 'fixed' were values of 'display', relative
positioning was handled through offset properties, and containing block
choice was handled some other way, but that's not the way the current
spec works...)

>   However this left me with another problem. By using padding-left and =
> padding-right I was able to get the article text to resize "properly", =
> that is, stay in a column in the middle of the screen nicely indented =
> from the sides. Now that I've instead moved the block with LEFT:8.5em, =
> what do I do with the right side so that it's also indented as before?  =
> Margin?  Padding again?

With absolute positioning you should be able to use the 'right'
property, assuming 'width' is 'auto'.  It's not as well supported by
browsers as 'left'.

-David

[1] http://www.w3.org/TR/REC-CSS2/visudet.html#containing-block-details

L. David Baron        <URL: http://www.people.fas.harvard.edu/~dbaron/ >
Mozilla Contributor                      <URL: http://www.mozilla.org/ >
Invited Expert, W3C CSS WG          <URL: http://www.w3.org/Style/CSS/ >
Member, WSP CSS AC              <URL: http://www.webstandards.org/css/ >
  dbaron@fas.harvard.edu             dbaron@netscape.com (Summer 2000)

Received on Wednesday, 30 August 2000 09:57:11 UTC