Hi,

I want to center the top menu in my site, currently it is aligned to the left.
In the CSS file the line that controls the menu is:

#navigation{height:35%;margin-top:1px;font-size:12px;background-color:#E5F0FA;overflow:hidden;width:100%;float:left;}

I tried adding:

margin-left:auto;margin-right:auto;

Also tried adding to the relavnet DIV:

<div id="navigation" style="text-align:center;"><jdoc:include type="modules" name="user3" style="xhtml" /></div>

Both didn't help.

Link to my site:
http://www.gamestoenjoy.com

How can I center this menu?

Thank you for your help :)

Recommended Answers

All 6 Replies

Member Avatar for diafol

is there any reason for the float?

just del float or for text in #navigation input text-align:center; for particular 'p' tag or other 'h' tags

I have ran into that myself. I use php inserts. Within the php insert, I make a table, align center, and make sure it is not involved in code that you already have going, (wrong place). Make sure you are not in another DIV line, pasting it in the wrong place.

A one column and one row table can be centered and will typically respond well, then put the navigation bar in the table. You can also set widths this way too, if you want that line to be a certain length. DIV will not do that either. I have set this one to 800px width, you can set to what you wish.

Try it.

[
<table width="800" align="center">
<tr>
<td align="center">
<div>
--->Your Navigation Insert Here Cleanly Between the Div Tags<---
</div>
</td>
</tr>
</table>
]

Good Luck!

SEODomainNames.com

Member Avatar for diafol

Tables are for data, not for layout. What you need can be achieved in CSS without resorting to 90's designs.

I get clean code, XHTML 1.0 Transitional, validator.wc3.org. it is only a couple of brackets. It sure works!

Member Avatar for diafol

> I get clean code, XHTML 1.0 Transitional, validator.wc3.org. it is only a couple of brackets. It sure works!

You serious? Semantic markup should be an XHTML priority surely? Tags for presentation are out.

Read this: http://www.seonotepad.com/uncategorized/seo-and-html-tables/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.