CSS Control div width max width/height and min width/height

Source: Internet
Author: User

InWeb AuthoringOften to control the maximum width of the div width/height or the minimum width/height, but in IE6 many friends will encounter incompatible headache problems, including I also often encounter such problems, in Baidu search a lot of can not solve, and later in a forum to learn, here with you to share underCSS3 StyleCode, through time fully compatible with major mainstream browsers.
* Minimum width of */.min_width{min-width:300px;
/* Sets max-width for IE */
_width:expression (Document.body.clientWidth < 300?) "300px": "Auto");
}

/* Maximum width */
. max_width{
max-width:600px;
/* Sets max-width for IE */
_width:expression (Document.body.clientWidth > 600?) "600px": "Auto");
}

/* min. Height */
. min_height{
min-height:200px;
/* Sets min-height for IE */
_height:expression (This.scrollheight < 200?) "200px": "Auto");
}

/* Maximum Height */
. max_height{
max-height:400px;
/* Sets max-height for IE */
_height:expression (This.scrollheight > 400?) "400px": "Auto");
}

/* Maximum minimum width */
. min_and_max_width{
min-width:300px;
max-width:600px;
/* Sets Min-width & max-width for IE */
_width:expression (
Document.body.clientWidth < 300? "300px":
(Document.body.clientWidth > 600?) "600px": "Auto")
);
}

/* Maximum minimum height */
. min_and_max_height{
min-height:200px;
max-height:400px;
/* Sets Min-height & max-height for IE */
_height:expression (
This.scrollheight < 200? "200px":
(This.scrollheight > 400?) "400px": "Auto")
);
}

CSS Control div width max width/height and min width/height

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.