0

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

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by clint6998
0
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.

0

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.

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.