Click here to get back home

CSS positioning: why does this work?

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
CSS positioning: why does this work? darius 05-15-2006
Posted by darius on May 15, 2006, 2:12 pm
Please log in for more thread options


Hi

I'm using CSS div to lay out my page.

I have the following


#layoutwrapper {
        margin: 0;
        padding: 40px 80px 10px 20px;
}

#navbar {
        width: 211px;
        position: absolute;
        top: 80px;
        left: 30px;
        z-index:2000;
}

#mainbox {
        position: relative;
        left: 255px;
        margin-right: 300px;
        min-width: 500px;

}

I think it's fairly self-explanatory.

<div id="layoutwrapper">
         <div id="navbar">navigation bar here
        </div>
        <div id="mainbox">main content here
        </div>
</div>

Here's what I don't understand. My intention is to leave ~100px empty on
the right side (for the screen, anyway). Yet the way I achieve this is
by setting #mainbox margin-right to 300px (!) Why? If I leave out
margin-right, I expect it to expand up to the width of the window, but it
actually takes more than that, forcing horizontal scrolling to see the
whole mainbox. Obviously it has to do with the navbar, but I don't know
quite how. Pls explain.

thanks
--
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth

Posted by VK on May 15, 2006, 1:55 pm
Please log in for more thread options



darius wrote:
> Hi
>
> I'm using CSS div to lay out my page.
>
> I have the following
>
>
> #layoutwrapper {
>         margin: 0;
>         padding: 40px 80px 10px 20px;
> }
>
> #navbar {
>         width: 211px;
>         position: absolute;
>         top: 80px;
>         left: 30px;
>         z-index:2000;
> }
>
> #mainbox {
>         position: relative;
>         left: 255px;
>         margin-right: 300px;
>         min-width: 500px;
>
> }
>
> I think it's fairly self-explanatory.
>
> <div id="layoutwrapper">
>          <div id="navbar">navigation bar here
>         </div>
>         <div id="mainbox">main content here
>         </div>
> </div>
>
> Here's what I don't understand. My intention is to leave ~100px empty on
> the right side (for the screen, anyway). Yet the way I achieve this is
> by setting #mainbox margin-right to 300px (!) Why? If I leave out
> margin-right, I expect it to expand up to the width of the window, but it
> actually takes more than that, forcing horizontal scrolling to see the
> whole mainbox. Obviously it has to do with the navbar, but I don't know
> quite how.

You may want to ask your question at
<comp.infosystems.www.authoring.stylesheets> instead.

"STRICTly speaking, what is 100%?" thread may be of your particular
interest:
<http://groups.google.com/group/comp.infosystems.www.authoring.stylesheets/browse_frm/thread/9d67e80f2b619804>


Posted by Michael Winter on May 15, 2006, 2:14 pm
Please log in for more thread options


On 15/05/2006 18:55, VK wrote:

[snip]

> You may want to ask your question at
> <comp.infosystems.www.authoring.stylesheets> instead.

Indeed. The question is entirely off-topic, here.

> "STRICTly speaking, what is 100%?" thread may be of your particular
> interest: [...]

It's totally unrelated. The OP needs to understand how relative
positioning works.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.

Posted by darius on May 15, 2006, 5:33 pm
Please log in for more thread options



> On 15/05/2006 18:55, VK wrote:
>
> [snip]
>
>> You may want to ask your question at
>> <comp.infosystems.www.authoring.stylesheets> instead.
>
> Indeed. The question is entirely off-topic, here.
>
>> "STRICTly speaking, what is 100%?" thread may be of your particular
>> interest: [...]
>
> It's totally unrelated. The OP needs to understand how relative
> positioning works.
>
> Mike
>

okay, thanks. I was searching for a group with 'css' in the name and
didn't find it. Didn't think of the obvious 'stylesheet'.
--
NewsGuy.Com 30Gb $9.95 Carry Forward and On Demand Bandwidth

Posted by Oliver Block on May 15, 2006, 2:12 pm
Please log in for more thread options


darius wrote:

The whole thing makes absolutely no sense to me.

If you are looking for how to postion a page, this might help you

<http://www.w3.org/TR/CSS21/visuren.html#fixed-positioning>

If not, never mind.

Best Regards,

Oliver


Similar ThreadsPosted
Positioning context - does it work? September 25, 2004, 1:58 pm
css positioning June 3, 2005, 4:14 am
positioning layers April 25, 2006, 7:40 am
CSS positioning pickle July 11, 2006, 9:15 pm
Positioning within March 20, 2008, 10:31 am
Style absolute positioning October 25, 2004, 12:14 pm
IE 6 (WinXP) and CSS positioning broken?? February 13, 2005, 11:17 am
Positioning of stuff in a relative way April 26, 2005, 4:45 pm
layout element positioning using CSS... June 7, 2006, 4:04 pm
Table Positioning....dynamic? October 11, 2006, 3:55 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap