Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Problem with auto margin in IE

Featured Replies

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

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 :)

  • 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 :)

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.