"Richard" <Anonymous@127.001> wrote:
> Sentient Fluid wrote:
>
>> I'm having trouble getting the menu below to centre horizonatally. I've
>> tried putting it into a container div and using text-align:center; I've
>> tried margin:auto and margin-left:auto & margin-right:auto; I've even
>> tried the deprecated <center> tag. None of it works.
>
>> I'm assuming it either has to do with the display:block (which I need to
>> keep the 'button look') or with the float:left.
It's with the float: left;
Floated elements will float to the specified side.
>> Of course I could be wrong, too. 
>
>> So what am I missing? Here's the link:
>
>> http://www.geocities.com/sentientfluid/test2.html
You've given each link a fixed width. This is a bad idea in general
(increase the font size in your browser and watch things fall apart)
but this does mean that you can center the links:
..center {width: 744px; margin-left: auto; margin-right: auto; }
But as we don't want the width to be in pixels we can change
everything to use em instead. Say width: 7.5em (and height: 1.5em

for the links and width: 50em; for the division).
It's not a perfect solution but with the poor support for CSS tables
and the inline-block/table display values it may be one of the least
worst ones.
Meanwhile in fantasy land, Richard was blathering....
>Padding and margin would hep center the link division setup.
Yes, but it's not that simple.
>text-align is just that. For text, not the division.
The links are text. Even if the text-align:center; was removed from
the a.topmenu style the text-align: center; on the div would still
center the text in the links themselves. But the links are also
floated so the boxes will still be at the left.
>Also, I'd avoid using "center" as a class name.
So would I. But for different reasons.
>icenter would be better.
No it wouldn't.
Something like navbar would be a sensible class name for a navigation
bar.
>just so that the script doesn't get confused as to which is which.
1. There is no script on that page.
2. A script that gets confused between a classname and something else
(the center element? The value center that the align attribute can
take? The value center that some CSS properties can take?) is a badly
written script. But I admit that you probably have a lot more
experience with writing scripts badly than I do.
Steve