November 11, 201015 yr Hi Everyone I am trying to centralise my wrapper on a web page I have coded css as follows: body {margin: 0; padding: 0; } #wrapper { width: 890px; margin: auto; } This works in all browsers except Internet Explorer. Any ideas? Thanks, Kath
November 11, 201015 yr Hi Kath, Change your code to this: body { margin: 0; padding: 0; text-align:center; } #wrapper { width: 890px; margin: 0 auto; text-align:left; } Sometimes IE plays up when you just state auto in the margin, so by changing it to only sett the left and right margins to auto and keeping the top and bottom to 0, that can fix one IE issue. Also older version of IE sometimes break so by telling the body to align text to the center and then use the wrapper to reset the default to left this also can help fix issues with ie centering content
November 11, 201015 yr Author Hi Kath, Change your code to this: body { margin: 0; padding: 0; text-align:center; } #wrapper { width: 890px; margin: 0 auto; text-align:left; } Sometimes IE plays up when you just state auto in the margin, so by changing it to only sett the left and right margins to auto and keeping the top and bottom to 0, that can fix one IE issue. Also older version of IE sometimes break so by telling the body to align text to the center and then use the wrapper to reset the default to left this also can help fix issues with ie centering content
November 11, 201015 yr Author That's brilliant - it worked!! Thank you so much. I would never have come up with that in 1 million years. Kath
Create an account or sign in to comment