The page I copied that from has a <h1> before the wrapper and a footer after
that expand the full width of the viewport.
What you have is ok too that makes it Static.
#wrapper {
text-align: left;
width: 740px;
margin: 0 auto;
}
Note:
An element with a static position *cannot* have values for offsets (top,
right, left, bottom) or if it has them, they will be ignored. Unless
explicitly positioned, all div elements default to static positioning.
So.... If you want to add offsets... you need relative Positioning.
Tom
| See below :>)
|
| > | I don't understand this code :>( If you could expand on this a bit,
I
| > | would appreciate it. Some points of interest for me:
| > |
| > | 1) Why position:relative? Wouldn't it be enough to just set the width
| > and
| > | right/left margin to auto?
| >
| > A relatively positioned page element is *not* removed from the flow of
| > the
| > code on the page, so it will use thespot where it would have appeared
| > based
| > on its position in the code as its zero point reference. If you then
| > supply
| > top, right, bottom, or left positions to the style for this element,
| > those
| > values will be used as offsets from its zero point.
|
| I understand the concept of Relative vs. Absolute positioning - my
question
| was: why use position:relative *at all*? Why not just use:
|
| #wrapper {
| text-align: left;
| width: 740px;
| margin: 0 auto;
| }
|
| The OP originally said he wanted to put all images and text inside a layer
| (div). So, this is a situation where I would normally not think of using
| position:relative or position:absolute. Since he's putting all the text
and
| images in the div, then the div would be the first line of code and not
need
| any positioning. It does not matter if it's removed from the flow or not
| since, in this case, it's being used as the main container. Of course, I
| haven't seen his site to know for sure. The way he describes it makes it
| seem like the main container and, therefore, first block of code.
|
| Since I wouldn't have thought of using position:relative, I thought you
may
| have used it for another reason that was not so obvious for me - a hidden
or
| little-known benefit, perhaps.
|
|
| > | 2) Why is this code (below) placed inside a comment? Are you trying to
| > hide
| > | it from another browser?
| > ---snip---
| >
| > Just an old style block that I have in FrontPage code snipets...
| > And yes it was to hide it from older browsers that couldn't handle CSS.
|
| OK. Just wondering :>)
|
|
| >
| > I need to update that - - Most are using newer than browser 4 now. 8)
| >
| > | 3) Same question about this code:
| > |
| > | > </div><!-- /wrapper -->
| > | > </body>
| >
| > This is just a comment so that you can keep track of the end of the
| > wrapper.
|
| I should have realized that. :>0 I usually use <!-- Close Wrap Div -->
|
| --
| Viken K.
|
http://www.vikenk.com
|
|