Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
My Div Won't centre in Internet Explorer
Old 12-14-2010, 06:49 PM My Div Won't centre in Internet Explorer
Novice Talker

Posts: 5
Name: Marc Allcock
Trades: 0
Hi, My content div moves out to the left in I.E even though it is inside a centered container div. It's fine in all other browsers. Please help?

Here's the site www.sugarrushdesign.com/test
Marc Allcock is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-14-2010, 08:01 PM Re: My Div Won't centre in Internet Explorer
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Don't use position:absolute! IE has some very well documented problems with positioning.. and besides, you don't need it anyway. Check our stickies for better centering methods.
The easiest: give your #container a width and then use margin: xx auto; to center. The XX would be for top and bottom margin values.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-15-2010, 12:09 AM Re: My Div Won't centre in Internet Explorer
Banned

Posts: 143
Name: maheshadodis
Location: USA
Trades: 0
Hi,
Check with margin and padding of your div and please use debugbar for Ie this is like firebug in firefox it will help you to fix problems in alignment
maheshadodis is offline
Reply With Quote
View Public Profile
 
Old 12-15-2010, 04:24 AM Re: My Div Won't centre in Internet Explorer
Novice Talker

Posts: 5
Name: Marc Allcock
Trades: 0
Thanks Guys. I'm going to recode the site without absolute positioning when the 9 to 5 is over.
Marc Allcock is offline
Reply With Quote
View Public Profile
 
Old 12-15-2010, 12:23 PM Re: My Div Won't centre in Internet Explorer
CSM
CSM's Avatar
Front-End Developer

Posts: 297
Name: Michael Pehl
Location: Palma de Mallorca
Trades: 0
Nice graphics but your code is really bad.

Whether it's your own site or the other one...

I would recommend learning HTML/CSS at w3schools.com ...

DreamWeaver is not the "holy grail" for people that want to "code" websites, bloated code (like all those img swap js functions... easier to do it with CSS),...
__________________
Chief Web Officer / Front-End Developer / System Engineer

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
CSM is offline
Reply With Quote
View Public Profile Visit CSM's homepage!
 
Old 12-16-2010, 01:21 AM Re: My Div Won't centre in Internet Explorer
Novice Talker

Posts: 6
Trades: 0
If your wanting to center a div, use:
margin: auto;
WuLF is offline
Reply With Quote
View Public Profile
 
Old 12-16-2010, 06:41 AM Re: My Div Won't centre in Internet Explorer
Novice Talker

Posts: 5
Name: Marc Allcock
Trades: 0
I've used margin auto for the wrapper one of the divs inside the wrapper is moving out to the left. Beyond the edges of the wrapper. However this only happens in internet explorer.
Marc Allcock is offline
Reply With Quote
View Public Profile
 
Old 12-16-2010, 06:44 AM Re: My Div Won't centre in Internet Explorer
Novice Talker

Posts: 5
Name: Marc Allcock
Trades: 0
You're right CSM my coding sucks. Thanks for your post.
Marc Allcock is offline
Reply With Quote
View Public Profile
 
Old 12-16-2010, 08:38 AM Re: My Div Won't centre in Internet Explorer
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Quote:
I've used margin auto for the wrapper one of the divs inside the wrapper is moving out to the left. Beyond the edges of the wrapper. However this only happens in internet explorer.
Soo.. how is that div coded/styled? Got the code?
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-16-2010, 09:16 AM Re: My Div Won't centre in Internet Explorer
Novice Talker

Posts: 5
Name: Marc Allcock
Trades: 0
Here's the code.

html, body {margin: 0; padding: 0;
background-image:url(../images/ornate.jpg);
background-repeat: repeat;
text-align:centre;
font-family:Arial, Helvetica, sans-serif;
font-size:12px;
}

.hidden {
display: none;
}

p {
color:#888888;
text-align:left;
}



#wrapper {
background-image:url(../images/wuwulogo.jpg);
background-position:center top;
background-repeat:no-repeat;
background-color:black;
width: 821px;
min-height:1000px;
height:auto;
margin-left:auto;
margin-right:auto;
margin-bottom:0;
border:0;

}




#nav {
height: 39px;
width: 579px;
background-color:black;
padding: none;
border:0;
margin-left:auto;
margin-right:auto;
position:absolute; top:330px; left:117px; right:123px;
text-align:center;

}

#content {
display:inline;
background-color:black;
height:600px;
width: 579px;
padding: none;
margin-left:auto;
margin-right:auto;
margin-top:0;
margin-bottom:0;
position:absolute; top:370px; left:117px; right:122px;
background-image:url(../images/footer.jpg);
background-position:bottom center;
background-repeat:no-repeat;
text-align:center;



}

Last edited by chrishirst; 12-16-2010 at 05:30 PM..
Marc Allcock is offline
Reply With Quote
View Public Profile
 
Old 12-16-2010, 08:31 PM Re: My Div Won't centre in Internet Explorer
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Your problem on #content is still that position:absolute. Is there any particular reason for it? Most of the time you just don't need it.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-16-2010, 10:47 PM Re: My Div Won't centre in Internet Explorer
Novice Talker

Posts: 6
Name: Maciej
Location: Poland
Trades: 0
If U want to center DIV, U should use margin: 0 auto; , and i think that min-height IE Fix is (i'm using it for ages):

min-height: 1000px;
height: auto !important;
height:1000px;
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
buggie is offline
Reply With Quote
View Public Profile Visit buggie's homepage!
 
Old 12-17-2010, 09:31 AM Re: My Div Won't centre in Internet Explorer
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
You should NEVER use that !important hack and it IS a hack - used by people who don't understand css specificity.. and that code is just not a good solution.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-17-2010, 10:33 AM Re: My Div Won't centre in Internet Explorer
Novice Talker

Posts: 6
Name: Maciej
Location: Poland
Trades: 0
Are U really sure that using it is wrong ? I found It here: http://www.dustindiaz.com/min-height-fast-hack/
and read more here: http://www.webmasterworld.com/css/3128123.htm

it doesn't seem like a bad idea to use it?
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
buggie is offline
Reply With Quote
View Public Profile Visit buggie's homepage!
 
Old 12-17-2010, 03:03 PM Re: My Div Won't centre in Internet Explorer
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
The point is, you should not be HACKING at all! If you need to target IE, then use conditional comments that call an "iefixes' css file that contains ONLY those rules needed to make IE display correctly.

By including hacks in your main CSS, you are just ASKING for future versions of IE to be broken!
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-18-2010, 11:56 AM Re: My Div Won't centre in Internet Explorer
Novice Talker

Posts: 6
Name: Maciej
Location: Poland
Trades: 0
OK, Thx for this advice!
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE
buggie is offline
Reply With Quote
View Public Profile Visit buggie's homepage!
 
Old 12-21-2010, 08:23 AM Re: My Div Won't centre in Internet Explorer
Josh C's Avatar
Novice Talker

Posts: 11
Location: London
Trades: 0
body {
text-align:center;
}

And set the DIV(s) to 'text-align: left;'

Should help. Hope it does.
__________________
Eternally growling in fury at IE.
Josh C is offline
Reply With Quote
View Public Profile
 
Old 12-21-2010, 12:06 PM Re: My Div Won't centre in Internet Explorer
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
That's not necessary, the margin: 0 auto; works just fine for all browsers.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-21-2010, 03:07 PM Re: My Div Won't centre in Internet Explorer
Josh C's Avatar
Novice Talker

Posts: 11
Location: London
Trades: 0
I'm pretty sure margin: 0 auto; doesn't work with some versions of IE.
__________________
Eternally growling in fury at IE.
Josh C is offline
Reply With Quote
View Public Profile
 
Old 12-21-2010, 06:16 PM Re: My Div Won't centre in Internet Explorer
serandfae's Avatar
Do the "Evil Nanner" !!!

Posts: 9,007
Name: Tim Daily
Location: Apex, NC, US, Sol 3
Trades: 0
Yes, margin: 0 auto; works in all versions of IE, even the demon spawn IE6.

tim
__________________
SEO "experts" smell like Big Fish_|_
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

serandfae is offline
Reply With Quote
View Public Profile Visit serandfae's homepage!
 
Reply     « Reply to My Div Won't centre in Internet Explorer

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.64329 seconds with 12 queries