Forum Moderators: not2easy

Message Too Old, No Replies

Min Width for a page

         

IanTurner

12:01 pm on Dec 15, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Is there a way I can set a min width for the page body using CSS?

grahamstewart

3:15 pm on Dec 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Depends on the behaviour you are looking for.

You can't stop the user resizing the browser to be too narrow to display your page - but you can (sort of) control at what point the browser stops squashing your page and just starts displaying a horizontal scrollbar instead.

richardb

3:29 pm on Dec 15, 2003 (gmt 0)

10+ Year Member



Try

min-width :?px;

Property is not defined in CSS Level 1

Rich

DrDoc

3:56 pm on Dec 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Now, the problem is that min-width isn't supported by IE. But, that can be worked around by using a combination of conditional comments and expressions.

For example, take a look at this thread: [webmasterworld.com...]

or, do something like this:

<!--[if IE]>
<style type="text/css">
#mydiv {
width: expression(document.body.clientWidth>725?"100%":"725px");
}
</style>
<![endif]-->

IanTurner

12:25 am on Dec 16, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



grahamstewart, that is exactly the behaviour I want to create. I am looking to prevent the page squashing to far, I am looking to force the horizontal scrollbar into action at a certain width.

DrDoc

12:38 am on Dec 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, Ian, if you use min-width for compliant browsers, and conditional comments for IE -- then that's what it will do for you :)

aevea

2:13 am on Dec 16, 2003 (gmt 0)

10+ Year Member



One trick I've used to force the horizontal scroll is a big h1 that stretches across the top of the main-content with: white-space: nowrap.

Adam