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
IE6 Wont Center an Image for its life
Old 03-04-2008, 04:38 PM IE6 Wont Center an Image for its life
Novice Talker

Posts: 5
Trades: 0
**** IE6. Dumb**** rat bastards.

Ok, now that I've got that out of my system, what the hell is wrong with IE6 and text-align? It will NOT center an image for the life of it.

Im trying to center an image inside a div:
Code:
<div style="width: 100px; float: right; text-align: center:">
<img src="blah" /><p>Some Text Here</p>
</div>
Of COURSE the text aligns properly but NOT the image. And of course it works in every other single ****ing browser ever made. I am running IE6 in Standards Mode. I have tried:

Code:
margin: 0 auto;
and

Code:
margin-left: auto;
margin-right: auto;
I have wrapped the bastard image in another div and tried to center it thinking the float: right might throw it off. Still no luck. That ****ing bastards glues itself to the left part of the div.

What the **** is wrong with IE6?
qwerty45 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-04-2008, 06:08 PM Re: IE6 Wont Center an Image for its life
Gilligan's Avatar
Website Designer

Posts: 1,670
Name: Stefan
Location: London, UK
Trades: 0
try align="center" instead of the style. Or make it just for ie6

Code:
<div<!--[if IE 6]>
align="center"
<![endif]-->>

Last edited by Gilligan; 03-04-2008 at 06:10 PM..
Gilligan is offline
Reply With Quote
View Public Profile
 
Old 03-04-2008, 06:14 PM Re: IE6 Wont Center an Image for its life
Novice Talker

Posts: 5
Trades: 0
No effect.
qwerty45 is offline
Reply With Quote
View Public Profile
 
Old 03-04-2008, 06:49 PM Re: IE6 Wont Center an Image for its life
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
And not necessary - try this - create a class for the image:

.imgBlock{display: block; margin: 0 auto;}

Add margins and padding as needed.
__________________
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 03-04-2008, 06:51 PM Re: IE6 Wont Center an Image for its life
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
The margin: 0 auto approach is the way you want to center the image.

You do need to specify a width and you also need to set a proper doctype. I'm guessing the doctype is the reason it wasn't working.

LadyNRed you beat me to the answer. Are you saying you don't need the doctype and width? Does display: block work instead? Or is that because the image likely has a width on it already?
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

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

Last edited by vangogh; 03-04-2008 at 06:52 PM..
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-04-2008, 06:55 PM Re: IE6 Wont Center an Image for its life
Novice Talker

Posts: 5
Trades: 0
Still nothing. Welcome to my world.
qwerty45 is offline
Reply With Quote
View Public Profile
 
Old 03-04-2008, 07:59 PM Re: IE6 Wont Center an Image for its life
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
You do need a proper Doctype, of course. A width isn't necessary on an image and the display:block with the margin: 0 auto; should work, I use this method all the time.

However, QWERTY, you MUST define the width and height of the image in your html, your example doesn't have any dimensions. You should ALWAYS set height and width on the img tag.

It might also be helpful if we could see all 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 03-04-2008, 08:20 PM Re: IE6 Wont Center an Image for its life
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I got it. I think it works then because you're specifying the width on the img tag. As long as the width is specified somewhere it works. It doesn't have to be in the css.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-05-2008, 12:13 AM Re: IE6 Wont Center an Image for its life
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Exactly
__________________
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 03-05-2008, 05:28 PM Re: IE6 Wont Center an Image for its life
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
For a moment I thought you meant that if you used display: block you didn't have to specify the width. I was excited about the new find as only a geek could be.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 03-05-2008, 08:33 PM Re: IE6 Wont Center an Image for its life
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
LOL
Well, if there's no width specified, there's no way for it to know what the 'auto' on the margins should be.. auto from what ?

Still, it's an easy method and works like a charm
__________________
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 03-06-2008, 05:49 AM Re: IE6 Wont Center an Image for its life
Skilled Talker

Posts: 52
Name: Bruce
Trades: 0
For it to work in IE you'll need it to be in strict mode, Qwerty.
SillyWilly is offline
Reply With Quote
View Public Profile
 
Old 03-06-2008, 02:16 PM Re: IE6 Wont Center an Image for its life
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
Not necessarily, but there DOES need to be a VALID doctype.
__________________
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
 
Reply     « Reply to IE6 Wont Center an Image for its life
 

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.66142 seconds with 12 queries