Julien wrote:
> Ben C a écrit :
>> On 2009-01-28, Julien <> wrote:
>>> Ben C a écrit :
>>>> On 2009-01-28, Julien <> wrote:
>>>>> Hello,
>>>>> I have a menu in css with position absolute, i have put auto for
>>>>> margin right and left and put it un a global div but my menu stay
>>>>> on the left.
>>>>> Could someone help me ?
>>>> You need to set left and right both to 0.
>>>>
>>>> [...]
>>>>> #menu {
>>>>> position: absolute;
>>>>> top: 251px;
>>>>> width: 743px;
>>>>> right: auto;
>>>>> left: auto;
>>>>> }
>>>> You don't seem to have actually set margin to auto. What you need is
>>>> something more like this:
>>>>
>>>> #menu {
>>>> position: absolute;
>>>> top: 251px;
>>>> width: 743px;
>>>> right: 0;
>>>> left: 0;
>>>> margin-left: auto;
>>>> margin-right: auto;
>>>> }
>>> Sorry, I said margin but it's didn't what i wanted to say.
>>> I just wanted to say i set righ and left "space" to auto.
>>
>> Yes, but that's not how you centre a positioned box. There's no rule
>> that says "solve for left and right under the constraint that they get
>> equal values". The browser solves for right if direction is ltr
>> otherwise for left.
>>
>> See http://www.w3.org/TR/CSS21/visudet.h...replaced-width
>>
>> You centre therefore with margins and left and right set to 0 as I
>> explained.
>
> It works on Firefox but not on my IE 6, you can check here :
> http://www.move-france.fr/index2.php
Thanks for the URL but, in future, it's better to provide one with a
simplified example of whatever you're asking about.
It'd be *especially* better to provide a page without that noise that
starts up automatically. Where's the damned OFF button?
We don't need to see all that JS, either.
Nor the frames and ads. Seems we're really looking at
http://electropica.free.fr/index2.php in the end.
I changed your rulest for #global to simply
#global { position: relative; }
in FF2 using Web Developer, and your menu stayed centered after that.
What's more, it stayed aligned with the background bevel as I resized
the viewport, which it didn't do in FF before. (All of this is only at
the font size you specify; when I try to upsize even one notch, the menu
breaks.
I didn't test this in IE6, but you're welcome to try it and see how it
works for you.
Why dl, dt, and dd for your menu? What are you defining?
Why JavaScript for your links? Wouldn't you like the links indexed by
search engines (and usable by human visitors without JS)?
HTH. Bon chance.
--
John
Possessive "its" has no apostrophe. Even on the Internet.