954,116 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

margin in css

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 .

rudz
Newbie Poster
19 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

i wana test it on ie6

rudz
Newbie Poster
19 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

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.

scottloway
Junior Poster in Training
55 posts since May 2008
Reputation Points: 22
Solved Threads: 12
 

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

rudz
Newbie Poster
19 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

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

scottloway
Junior Poster in Training
55 posts since May 2008
Reputation Points: 22
Solved Threads: 12
 

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

Wrams
Newbie Poster
22 posts since Nov 2008
Reputation Points: 28
Solved Threads: 1
 
Interesting, so was IE6 in quirks then? Out of curiosity, what was your previous (problematic) doctype?


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

rudz
Newbie Poster
19 posts since Oct 2009
Reputation Points: 10
Solved Threads: 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.

Wrams
Newbie Poster
22 posts since Nov 2008
Reputation Points: 28
Solved Threads: 1
 

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.

rudz
Newbie Poster
19 posts since Oct 2009
Reputation Points: 10
Solved Threads: 0
 

I don`t find any problem!

sereYboth
Newbie Poster
7 posts since Feb 2009
Reputation Points: 10
Solved Threads: 0
 

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.

Wrams
Newbie Poster
22 posts since Nov 2008
Reputation Points: 28
Solved Threads: 1
 

'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.

Zero13
Practically a Master Poster
624 posts since Jan 2009
Reputation Points: 120
Solved Threads: 138
 
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.

Labhrainn Aemi
Newbie Poster
1 post since Nov 2009
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You