---
title: "Center align a container in IE"
url: https://thecancerus.com/center-align-a-container-in-ie/
date: 2008-05-16
modified: 2008-05-16
author: "ican"
description: "Today i faced a problem while trying to center align my main div in IE6. The Problem #main { width:960px; margin:0 auto; } This made my div to align itself..."
categories:
  - "css"
tags:
  - "center align the div in Internet explorer"
  - "css"
  - "css tip"
  - "firefox"
  - "IE&"
  - "IE6"
word_count: 105
---

# Center align a container in IE

Today i faced a problem while trying to center align my main div in IE6.

**The Problem**

#main
{
width:960px;
margin:0 auto;
}
This made my div to align itself in the center in firefox and Internet Explorer 7 but, it failed to do the trick for IE6.

After some googling i found following solution on [Webcredible.co.uk](http://www.webcredible.co.uk/user-friendly-resources/css/internet-explorer.shtml) website. I added my "[simple css hack](http://thecancerus.com/simplest-css-hack-ever/)" to make sure it was available only in Internet Explorer.
**
The Solution**

body
{
_text-align:center;
}
#main
{
width:960px;
margin:0 auto;
_text-align:left;

}
That's it, we are done this will center align the container in the center of the browser window