margin-left:auto;
margin-right:auto;

is working in firefox but not working in ie can someone help plz i want to center the page .

Recommended Answers

All 12 Replies

i wana test it on ie6

As long as the div you're attempting to center has a static width, IE6+ shouldn't have a problem with auto.

Perhaps if you provided a URL, or code snippets, we'd be able to better help you.

As long as the div you're attempting to center has a static width, IE6+ shouldn't have a problem with auto.

Perhaps if you provided a URL, or code snippets, we'd be able to better help you.

thx man i found the problem it was from the doctype of the html

Interesting, so was IE6 in quirks then? Out of curiosity, what was your previous (problematic) doctype?

To center a page you should use this CSS

#header {
        margin: 0 auto;
}
#wrapper {
       margin: 0 auto;
}
#footer {
       margin: 0 auto;
}

This >>> margin: 0 auto; <<< Will center whatever CCS section its in. If you want something to move left or right then you replace this with the

float: left;

or

float: right;

elements.

Hope this helps.

I am a Web Developer and all the developers I know use this software. Its Open Source (Free) and shows you bugs in all Internet Explorer from IE5, 6, 7 & 8

Its called IETester and you can download it from here >>> IETester

Interesting, so was IE6 in quirks then? Out of curiosity, what was your previous (problematic) doctype?

i 4 get it i guess doctype1.0....

Right click on your websites homepage or where ever the problem lies and then select View Source then go right to the top and copy the code Doctype Decleration here.

That way we can see if its got a mis type or something.

Right click on your websites homepage or where ever the problem lies and then select View Source then go right to the top and copy the code Doctype Decleration here.

That way we can see if its got a mis type or something.

i closed it without saving so i can't get it.

I don`t find any problem!

You have access to his website? The thing is where trying to help but as of yet he has not give us any coding what-so-ever. So where fighting an uphill battle trying to sort out a site with no information. Impossible I think!

If you can provide us with some sort of coding we can help sort this issue out so that if it happens again you will know exactly what to do to sort this problem out.

Surely you have access to the website...? Whats your websites URL? Just paste it in here so we can view the source ourselves and figure out any bugs or glitches. They don't mind you posting your web site in the forums as long as it's for help and not spamming.

'margin' auto needs DOC type in IE. And what is your code. If you don't show your code, we can't find what the problem is. So, post your code. Insert the doc type in your html first. Try this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">

If it not ok, post your code here.

img.right { float: left; margin: 0 10px 10px 0; }
div.clear { display: block; height: 0; clear: both; }

Make sure you add <div class="clear"></div> afterwards or it could mess up any other floats you may have on your page.
<FAKE SIGNATURE>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.