Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.

Thread Tools Display Modes
Share |
Old 08-17-2010, 11:09 AM
sanguinerane sanguinerane is offline
Junior Member
Join Date: 07-01-10
Location: hanover, nh
Posts: 8
iTrader: 0 / 0%
CSS Menu Centering

Hey everyone,

I am having a bit of trouble centering my two main menus.
Right now, it looks centered on FF, Chrome, Safari, etc. but only because I added a little padding to the left side of it.
However, on IE7/IE8 the menu isn't centered. I could tweak the ie7 and ie8 only style sheets, but I would like to get rid of the problem altogether by centering it.
I've tried text-align:center; and various forms of margin:0px auto; all to no avail.

Any ideas?

Thanks in advance,
Reply With Quote



Old 08-17-2010, 04:00 PM
Reakon Reakon is offline
Junior Member
Join Date: 08-05-10
Posts: 16
iTrader: 0 / 0%
It's centered when I look using IE7
Reply With Quote
Old 08-17-2010, 05:18 PM
sanguinerane sanguinerane is offline
Junior Member
Join Date: 07-01-10
Location: hanover, nh
Posts: 8
iTrader: 0 / 0%
sorry i forgot to mention, but i centered it manually in ie using extra padding on the left side (separate style sheets for ie7 and ie8 to do this)
i was just wondering if there was a way to do it exactly with a text-align:center; or auto margin
if not, no worries - it looks centered but it isnt coded as centered.. if that makes any sense..
oh well, thanks for the reply anyways!
Reply With Quote
Old 10-04-2010, 12:05 AM
mmaloney mmaloney is offline
Contributing Member
Join Date: 10-03-10
Posts: 50
iTrader: 0 / 0%
automargin 0 will normally center
Reply With Quote
Old 10-04-2010, 12:30 AM
ernie's Avatar
ernie ernie is offline
Join Date: 10-01-10
Location: Belgium / Denmark
Posts: 42
iTrader: 0 / 0%
Check out this: http://www.yourhtmlsource.com/styles...csslayout.html -> bottom of document. I think that might do it.
Reply With Quote
Old 10-06-2010, 02:00 AM
Avinash's Avatar
Avinash Avinash is offline
v7n Mentor
Join Date: 08-23-06
Location: Jungles
Posts: 1,684
iTrader: 0 / 0%
I suggest that you read this whole article on horizontally centering elements.

After spending some time on your site, I realized that you're using floats way too much. Floats will create problems in centering elements horizontally. Make sure you avoid using floats altogether (if possible) or properly clear floats. In case of centering list items, you could use "display:inline;" instead of floating them.

Get inspiration from centering elements like images. For example, if you set an element's display property to "display:block;" and margin to "margin: 0 auto;", it'll get centered.

Last edited by Avinash; 10-06-2010 at 02:08 AM.
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Layout Centering with CSS SofreeWeb Coding Forum 2 08-18-2009 05:52 AM
Centering Images mack77 Web Design Lobby 6 12-18-2008 07:32 AM
CSS Menu centering mat4020 Coding Forum 8 03-26-2008 05:38 PM
Centering Horizontal CSS Menu thecoolkid Coding Forum 13 08-30-2007 09:59 PM
DHTML Menu slide menu how to make it relative to table ajay201975 Web Design Lobby 0 05-25-2004 09:54 AM

V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory

All times are GMT -7. The time now is 08:27 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC