Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

center dive in IE 1

Status
Not open for further replies.

IPGuru

Vendor
Jun 24, 2003
8,391
GB
I am trying to center a div with the following
Code:
#Content {
 width=400px;
 margin-left:auto;
 margin-right:auto;
}

<div id="Content">
various text & other things
</div>

& suprise suprise it does not work in IE
am i missing anything obvious?
 
You are. In CSS, you delimit attributes and values with colon (like the margins) not with the equal sign. You have placed an equal sign erroneously in the width attribute. IE is forgiving and guesses you meant to use a colon, but other browsers are stricter.

If you change the equal sign to colon it will all work as expected.

[small]Do something about world cancer today: Comprehensive cancer control information at PACT[/small]
 
The '=' was a typo
I was using ':' in my CSS however I was being a bigger idiot
My doctype definition was not the 1st line output so IE was running in Quirks mode

Obviously this was not a problem with a properly behaved browser
Many thanks for the reply I am sure it will help others
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top