views:

30

answers:

2

Hi I want to do a fixed size page, but don't want the page to break or reflow at all if the user resizes the window. Is this a javascript function?

sample: http://www.neimanmarcus.com/

+1  A: 

Most people put all the content of there page inside a div with an id, such as 'doc', then they would apply the following rule:

<body><div id="doc">
YOUR PAGE HERE
</div></body>
body {
test-align: center;
}

#doc {
margin: 0 auto;
text-align: left;
width: 940px
}

The "text-align" fixes an IE 6 issue, really you just need to assign a margin to your wrapping document div.

matt snider
oh, duh, I had a page where a rtow of images were breaking, but did't apply a fixed width to them. Thanks to both of you!
Brad
A: 

No. It's just using a fixed-width wrapper <div> element - easy enough to see if you use a browser with an HTML inspect.

In the case of the page you linked, the markup is:

<div id="contentbody">...</div>

and the CSS applied to that div is

#contentbody {
    clear: both;
    float: left;
    margin: 0px auto; /* center the element in its offset parent */
    text-align: left;
    width: 940px; /* here's the fixed width! */
}
Matt Ball