Do you mean that you want to center it vertically or horizontally? You said you specified the height
to 800 pixels, and wanted the div not to stretch when the width
was greater than that...
To center horizontally, you can use the margin: auto;
attribute in CSS. Also, you'll have to make sure that the body
and html
elements don't have any margin or padding:
html, body { margin: 0; padding: 0; }
#centeredDiv { margin-right: auto; margin-left: auto; width: 800px; }