BradTrupp.com --
Tags --
Old Articles -- Minimum Width for a Page using CSS (Website Tips)
Minimum Width for a Page using CSS (Website Tips)
(2008/10/14)
A very handy CSS command that exists is the min-width command,
As you use it to specify a minimum width for any element,
it is particularly useful for specifying a minimum width for a page.
Some versions of IE still don't understand this command, so we'll need to
come up with a alternate way of making this functionality work in this browser.
First, insert a <div> under the <body> tag, as we can't assign a
minimum width to the <body>:
<body>
<div class="container">
|
Next, create our CSS commands to create a minimum width of 660px:
#container
{
min-width: 660px;
width:expression(document.body.clientWidth < 660? "660px": "auto" );
}
|
The first command is the regular minimum width command.
The second is a short JavaScript command that only IE will understand.
You might also combine with a maximum width with your minimum.
#container
{
min-width: 660px;
max-width: 1200px;
width:expression(document.body.clientWidth < 660? "660px" : document.body.clientWidth > 1200? "1200px" : "auto");
}
|
Tags: Old Articles
Share: Del.icio.us | Digg | Facebook | Google Bookmarks | Reddit | Technorati | Twitter | Windows Live | Yahoo! My Web