Forum Moderators: not2easy

Message Too Old, No Replies

How do I force a minimum page width?

eg... i want to make a page at least 700px wide

         

londrum

9:29 pm on May 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



i know i should probably know this, but it has been foxing me for hours now...
how do i force a liquid layout to have a minimum width?

eg... i want the horizontal scrollbars to appear if the browser window is less than 700 pixels.

there are no tables or anything like that on the page. the only tags i am able to style are <body> and <div>.

but the problem is that the <div> already has a width. and it does not span the entire width of the page.

is there a way to apply a width to the <body> tag?

Receptional Andy

10:34 pm on May 18, 2008 (gmt 0)



I would guess min-width/max-width [w3.org] are what you need, with the familiar curse of them not working in IE6.

Setek

1:00 am on May 19, 2008 (gmt 0)

10+ Year Member



Yeah you can apply a minimum width to the
<body>
element, but you'll need to do a little extra just for IE 6. Should go like this:

For standards-compliant browsers

body { min-width: 700px; }

Just for IE 6 (read up on conditional comments [webmasterworld.com] if you don't know what they are already.)

body { width: expression((document.body.clientWidth < 730) ? '700px' : 'auto'); }

Things to note: If the expression for IE uses two of the same values the browser will crash when it reaches that width. Just have a play and see at what point it will do what you want it to, without crashing.

pageoneresults

1:31 am on May 19, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If the expression for IE uses two of the same values the browser will crash when it reaches that width. Just have a play and see at what point it will do what you want it to, without crashing.

lol, Rucssian Roulette

Setek

2:09 am on May 19, 2008 (gmt 0)

10+ Year Member



lol, Rucssian Roulette

Hahaha I've always likened "having to deal with Internet Explorer" to "shooting yourself in the head" too!