homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Centering links in DIV

 7:21 pm on Jan 4, 2003 (gmt 0)


Here's another problem I am struggling with ...

I have a menu that consists of a DIV with anchors in it.

HTML Example:
<DIV class="Menu">
<A class="MenuItem" href="">Menu Item 1</A>
<A class="MenuItem" href="">Menu Item 2</A>

width: 20%;
text-align: center;

width: 150px;
display: block;
text-align: left;

In IE, I get a menu with centered menu-items that are aligned left.

In mozilla, I get a menu with everything aligned left.

I guess that Mozilla doesn't allow a text-align center to align block elements within a div ...

How can I do this?




 8:53 pm on Jan 4, 2003 (gmt 0)

Yoeri- Welcome to Webmaster World.

You should set the margins to auto anyway, text-align should be used for text.

width: 150px;
display: block;
margin-left: auto;
margin-right: auto;
border: 1px solid #ccc;
text-align: left;

I think this is what you're trying to do. I put borders in to see what was happening.


 11:05 am on Jan 5, 2003 (gmt 0)


work like I want it :-)

Never used the auto value for the margins ... will take a look at what it exactly does .


 11:22 am on Jan 5, 2003 (gmt 0)

I found another link in the forum that gives the solution ...

The text-align center is being used to center block alements in IE5 ... guess I am working to much with IE :)

[bluerobot.com ]

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved