|
|||||||
| HTML Discussion and technical support for building, using and deploying HTML sites. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Margin:AUTO does not work in IE
I center a lot of things using css with
#div {margin:auto; width:xxx;} While this works in FF perfectly, IE does not center this div - so how do I get things to center IE as well? |
|
#2
|
||||
|
||||
|
The best way is to give a parent element to #div, and write something like
#divparent{text-align:center;} #div {margin:auto; width:xxx; text-align:left;} (unless you want the text centered as well.)
__________________
Coach Random Comic |
|
#3
|
|||
|
|||
|
Text alignment is not my problem - but thanks anyway.
I should have been more detailed. My problem is entire "blocks" of information are not being centered. For example - the biggest block: the website wrapper is not being centered. #wrapper {margin:auto; width:1000px; height:100%; margin-top:5px; background-color:white; overflow:auto} That's what I have - and all content goes inside of this 1000px wide block (website meant for 1024x768 resolution and higher, I can't stand making ones for less). Anyway, in FF, this entire block is centered, while in IE is appears on the left. Last edited by blade52x; 06-15-2007 at 06:41 PM. |
|
#4
|
||||
|
||||
|
You don't understand, bud. IE doesn't support margin:auto;. text-align:center is a workaround. Try it.
__________________
Coach Random Comic |
|
#5
|
|||
|
|||
|
Ok lol I didn't understand (but now I do), so I tried it and it worked!
Thank you! |
|
#6
|
||||
|
||||
|
IE does support "margin:auto;" if there is a WIDTH to the element, and a valid !doctype. In the lack of a valid !doctype, IE is in 'quirks mode' and 'guesses' (worse than usual)...
Quote:
__________________
Help Save Ana My Portal: I Build WebPagesPricing? Read:http://www.webdeveloper.com/forum/pricing_faq.html AUP: http://www.jupitermedia.com/corporate/privacy/aup.html I test with: Firefox, Mozilla, Opera, Safari-on-XP, Google Chrome, SeaMonkey Internet.com freelancers Last edited by WebJoel; 06-15-2007 at 07:57 PM. |
|
#7
|
||||
|
||||
|
Quote:
|
|
#8
|
||||
|
||||
|
[QUOTEFalse information ...............[/quote] I'm a little more charitable here... doesn't support it without a width statement and a valid !doctype. I could see how one might at first run at this might think that IE doesn't support margin:auto;. OP asked 'how to center in IE' but also mentioned 'works in Firefox' and without seeing the whole code, 99% confidence that this is a missing valid !doctype issue.
__________________
Help Save Ana My Portal: I Build WebPagesPricing? Read:http://www.webdeveloper.com/forum/pricing_faq.html AUP: http://www.jupitermedia.com/corporate/privacy/aup.html I test with: Firefox, Mozilla, Opera, Safari-on-XP, Google Chrome, SeaMonkey Internet.com freelancers |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|