min-width and max-width is very useful command of CSS, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page.
Unfortunately, this command IE doesn’t understand, so we’ll need to come up with a new 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>
Next, we create our CSS commands, to create a minimum width of 600px:
#container
{
min-width: 600px;
width:expression(document.body.clientWidth < 600? “600px”: “auto”);
}
The first command is the regular minimum width command; the second is a short JavaScript command that only IE understands. Do note, though, that this command will cause your CSS document to become invalid; you may prefer to insert it into the head of each HTML document to get around this.
You might also want to combine this minimum width with a maximum width:
#container
{
min-width: 600px;
max-width: 1200px;
width:expression(document.body.clientWidth < 600? “600px” : document.body.clientWidth > 1200? “1200px” : “auto”);
}
Great post! Nice blog.
Maximum and Minimum Width Solution for All Browsers | Ejaz Ahmad…
min-width and max-width is very useful command of CSS, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page. Unfortunately, this command IE doesn’t understand, so we’ll nee…
Maximum and Minimum Width Solution for All Browsers | Ejaz Ahmad…
min-width and max-width is very useful command of CSS, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page. Unfortunately, this command IE doesn’t understand, so we’ll nee…
Maximum and Minimum Width Solution for All Browsers | Ejaz Ahmad…
min-width and max-width is very useful command of CSS, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page….
good one
Maximum and Minimum Width Solution for All Browsers…
Thank you for submitting this cool story – Trackback from Servefault.com…
Maximum and Minimum Width Solution for All Browsers | Ejaz Ahmad…
min-width and max-width is very useful command of CSS, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page….
Maximum and Minimum Width Solution for All Browsers | Ejaz Ahmad…
min-width and max-width is very useful command of CSS, whereby you can specify a minimum width for any element. This can be particularly useful for specifying a minimum width for a page. Unfortunately, this command IE doesn’t understand, so we’ll nee…
Social comments and analytics for this post…
This post was mentioned on Twitter by pinceladasdaweb: Maximum and Minimum Width Solution for All Browsers: http://migre.me/idfX…
This article has been shared on favSHARE.net. Go and vote it!
Hello. I don’t read many blogs, but yours is of thefew I read.Have a awesome day!
I really like what you published here – it’s well-written. Thanks for posting this. I’ve been experimenting with WordPress lately. Do you utilize WordPress? Any tips for me? Click here if you’d like to check out my site. Have a great week!
Hello, firstly I want to tell you that I follow your blog. Great post, I fully agree with you. Have a good day maty.
nice post. thanks.
Pretty nice post. I just stumbled upon your blog and wanted to say that I have really enjoyed browsing your blog posts. In any case I’ll be subscribing to your feed and I hope you write again soon!
a good resource.thanks