Web Design Web Design Forum
Registration is free! Here you can view your subscribed threads, work with private messages and edit your profile and preferences Calendar Find other members Frequently Asked Questions Search
Home Web Design

Convenient web based access to our favorite web design Usenet groups

web design reviews

This is Interesting: Free Magazines for Graphics designers and webmasters  





Pages (2): [1] 2 »   Last Thread  Next Thread
Author
Thread Post New Thread   

Why is my menu off-center?
 

Pierre Jelenc




quote this post edit post

IP Loged report this post

Old Post  09-20-05 - 04:20 AM  
The demo page at http://www.robschwimmer.com/tmp/test.html has a menu at
the bottom, which should be centered 50 pixels from both left and right
edges. As the dotted green line around the enclosing div indicates, it is
--in Mozilla at least-- actually pushed to the right.

Both HTML and CSS validate fine (there are some warnings on the CSS having
to do with color, but that's deliberate for the way I set the text
colors.)

Any idea what's happening?

Thanks,

Pierre
--
Pierre Jelenc         |      New on Home Office Records: Ethan Lipton
|  www.homeofficerecords.com     www.ethanlipton.com
The Gigometer       |          Pepper Of The Earth: the HO blog
www.gigometer.com     |           www.homeofficerecords.com/blog


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

RobG




quote this post edit post

IP Loged report this post

Old Post  09-20-05 - 09:24 AM  
Pierre Jelenc wrote:
> The demo page at http://www.robschwimmer.com/tmp/test.html has a menu at
> the bottom, which should be centered 50 pixels from both left and right
> edges. As the dotted green line around the enclosing div indicates, it is
> --in Mozilla at least-- actually pushed to the right.

Get rid of the 50px margin-left/right.

[...]

--
Rob


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

Roy Schestowitz




quote this post edit post

IP Loged report this post

Old Post  09-20-05 - 09:24 AM  
__/ [Pierre Jelenc] on Tuesday 20 September 2005 00:30 \__

>
> The demo page at http://www.robschwimmer.com/tmp/test.html has a menu at
> the bottom, which should be centered 50 pixels from both left and right
> edges. As the dotted green line around the enclosing div indicates, it is
> --in Mozilla at least-- actually pushed to the right.
>
> Both HTML and CSS validate fine (there are some warnings on the CSS having
> to do with color, but that's deliberate for the way I set the text
> colors.)
>
> Any idea what's happening?
>
> Thanks,
>
> Pierre


There is a way of forcing divs to lie in the centre using some negative
values, but I could not find a reference. What you are trying to do will
not work in the Mozilla renderer. The margin-right will be ignored. You can
either compromise and go for:

"margin-left: 50px; width: 90%;"

which in practice looks quite OK if I reside the window quite widely. Also,
consider adding two fixed-sized divs to the left and the right of your
menu. Not elegant, but does the trick



__/ [RobG] on Tuesday 20 September 2005 05:52 \__


> Get rid of the 50px margin-left/right.
>
> [...]

This doesn't appear to be "doing the trick" in Firefox.


Roy

--
Roy S. Schestowitz      | "Free the mind, the source will follow"
http://Schestowitz.com  |    SuSE Linux    |     PGP-Key: 74572E8E
7:35am  up 25 days 19:49,  3 users,  load average: 1.22, 0.65, 0.44


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

boclair




quote this post edit post

IP Loged report this post

Old Post  09-20-05 - 12:26 PM  
Pierre Jelenc wrote:
> The demo page at http://www.robschwimmer.com/tmp/test.html has a menu at
> the bottom, which should be centered 50 pixels from both left and right
> edges. As the dotted green line around the enclosing div indicates, it is
> --in Mozilla at least-- actually pushed to the right.

Set width rule at less than 100%, say 90%, and set the left rule at half
of that, say 5%

This will render as you wish in Moz but IE does not honour position fixed.

You could get something cross browser by using position absolute instead
but this may result in other problems according to page length.

Louise


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

RobG




quote this post edit post

IP Loged report this post

Old Post  09-20-05 - 12:26 PM  
Roy Schestowitz wrote:
[...]
> __/ [RobG] on Tuesday 20 September 2005 05:52 \__
>
>
> 
>
>
> This doesn't appear to be "doing the trick" in Firefox.
>

Depends on the trick!  :-)

If the 'menu' was the string of buttons, then yes it did for me in
Firefox.  But if the green-bordered div is the menu, then it extends for
the width of the page, which may not be the right trick. :-o

--
Rob


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

Pierre Jelenc




quote this post edit post

IP Loged report this post

Old Post  09-21-05 - 12:40 AM  
boclair  <boclair@bigpond.net.au> writes:
>
> Set width rule at less than 100%, say 90%, and set the left rule at half
> of that, say 5%

Thanks, that could work unless the window is very narrow: in some pages I
will have a 50-pixel wide motif running down the edge on either the left
or the right.

> This will render as you wish in Moz but IE does not honour position fixed.

But it will then place the menu at its logical position according to
where the div is in the HTML code, right? Bottom of the page rather than
bottom of the window, for instance.

> You could get something cross browser by using position absolute instead
> but this may result in other problems according to page length.

Page length will be very variable, not only from page to page but also
temporally on some pages such as a show calendar. The menu does not have
to be in the same place across browsers, though.

Thanks to all.

Pierre
--
Pierre Jelenc         |      New on Home Office Records: Ethan Lipton
|  www.homeofficerecords.com     www.ethanlipton.com
The Gigometer       |          Pepper Of The Earth: the HO blog
www.gigometer.com     |           www.homeofficerecords.com/blog


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

Jim Moe




quote this post edit post

IP Loged report this post

Old Post  09-21-05 - 12:40 AM  
Pierre Jelenc wrote:
> The demo page at http://www.robschwimmer.com/tmp/test.html has a menu at
> the bottom, which should be centered 50 pixels from both left and right
> edges. As the dotted green line around the enclosing div indicates, it is
> --in Mozilla at least-- actually pushed to the right.
>
Wrap the nav div in another div that does the positioning:
#place-the-bar { border: 1px solid white;
position: fixed;
z-index: 100;
bottom: 0;
width: 100%;
}
#bottomnavbar {
border: dotted green medium;
margin-left: 50px; margin-right: 50px;margin-top: 5px;
padding-bottom: 10px; padding-top: 10px;
text-align: center;
background-color: #333;
}

..

<div id="place-the-bar">
<div id="bottomnavbar">
..
</div>
</div>

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

Pierre Jelenc




quote this post edit post

IP Loged report this post

Old Post  09-21-05 - 04:28 AM  
Jim Moe  <jmm-list.AXSPAMGN@sohnen-moe.com> writes:
>
>    Wrap the nav div in another div that does the positioning:

Thanks! The problem is then only when the problematic div is contained
directly in the body? Is there any reason why I should not systematically
put a "wrapper" div  in all pages to remove this problem?

Pierre
--
Pierre Jelenc         |      New on Home Office Records: Ethan Lipton
|  www.homeofficerecords.com     www.ethanlipton.com
The Gigometer       |          Pepper Of The Earth: the HO blog
www.gigometer.com     |           www.homeofficerecords.com/blog


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

Roy Schestowitz




quote this post edit post

IP Loged report this post

Old Post  09-21-05 - 12:20 PM  
__/ [RobG] on Tuesday 20 September 2005 09:41 \__

> Roy Schestowitz wrote:
> [...] 
>
> Depends on the trick!  :-)
>
> If the 'menu' was the string of buttons, then yes it did for me in
> Firefox.  But if the green-bordered div is the menu, then it extends for
> the width of the page, which may not be the right trick. :-o

I think the intention was for the box to have buffers of fixed size... don't
ask me why...

Roy

--
Roy S. Schestowitz      | Useless fact: Sharks are immune to cancer
http://Schestowitz.com  |    SuSE Linux    |     PGP-Key: 74572E8E
9:25am  up 26 days 21:39,  3 users,  load average: 0.10, 0.14, 0.46


Post Follow-Up to this message ]
Re: Why is my menu off-center?
 

Jim Moe




quote this post edit post

IP Loged report this post

Old Post  09-22-05 - 12:34 AM  
Pierre Jelenc wrote:
> 
>
> Thanks! The problem is then only when the problematic div is contained
> directly in the body? Is there any reason why I should not systematically
> put a "wrapper" div  in all pages to remove this problem?
>
To be honest, I do not know why wrapping the div worked. But to achieve
the layout you are after, yes, use the two step div: one for position, one
for layout.
It would seem that margin and padding have a different origin reference
when position:fixed or :absolute is indicated. (Maybe if I became less
lazy and read the spec....)

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


Post Follow-Up to this message ]
Sponsored Links
 





All times are GMT. The time now is 07:09 AM. Post New Thread   
Pages (2): [1] 2 »   Previous Last Thread   Next Thread next
Stylesheets archive | Show Printable Version | Email this Page | Subscribe to this Thread

Popular forums

Adobe Photoshop forum Macromedia Flash Web Site Design
Dreamweaver FrontPage forum
JavaScript Forum XML forum
Style Sheets VRML
Forum Jump:
Rate This Thread:

 

XML RSS Feed web design latest articles Syndicate our forum via XML or simple JavaScript

Web Design archive  Database administration help  


Top Home  -  Register  -  Control Panel   -  Memberlist  -  Calendar  -  Faq  -  Search Top