Centering an Image in IE7

I've defined a class in my style sheet as below:

    display: block;
    margin-right: auto;
    margin-left: auto;

And then I assign the class to certain <img> tags:

        <img src="images/Performance.jpg" class=fig />  

For FireFox this centers the image fine, but it seems to have no effect in IE7. The image remains left-justified.  What more is needed for IE7?

Who is Participating?
David S.Connect With a Mentor Commented:
It sounds like IE is in quirks mode. Make sure you use a doctype that triggers "standards mode".
stevaAuthor Commented:
Thanks. My doctype was there but had an extra <! in front of it::

<!<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"

IE couldn't find a valid DTD then so reverted to quirk mode.  Removing the <! got the image to center in IE7.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.