I am building a site and the main couple of DIV tags are not centered in IE but they are in firefox, opera and chrome. any ideas? here is my css code for my problem:

body
{
	color: #333;
	margin:0 auto;
	background-image: url(images/bg.gif);
	background-repeat: repeat-x;
	background-color: #fde0dd;
}

#main
{
	width: 734px;
	margin:0 auto;
	color: #333;
	font-family: Arial, Helvetica, sans-serif;
	align: center;
	
}

Where body is the body and #main wraps ALL other content and code.

any ideas?

Thanks,

Clint

Member Avatar for diafol
body
{
	color: #333;
	margin:0 auto;
	background-image: url(images/bg.gif);
	background-repeat: repeat-x;
	background-color: #fde0dd;
}
 
#main
{
	width: 734px;
	margin:0 auto;
	color: #333;
	font-family: Arial, Helvetica, sans-serif;
	align: center;
 
}

No need to centre body. No such property as 'align'. Try this:

body
{
	color: #333;
	background-image: url(images/bg.gif);
	background-repeat: repeat-x;
	background-color: #fde0dd;
        text-align: center;
}
 
#main
{
	width: 734px;
	margin:0 auto;
	color: #333;
	font-family: Arial, Helvetica, sans-serif;
	text-align: left;
 
}

The text-align properties should serve to sort out earlier versions of IE.

IE needs DTD to support auto margin. You can use these.
In transitional mode:

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

In strict mode:

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

In frame-set mode:

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

You should always validate your markup. Go here to validate.

ardav: thanks but i was not wanting to center my text, but the div tag holding the text.

zero13: thanks! i had overlooked that and that was what I forgot.

Clint

Be a part of the DaniWeb community

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