How to get IE6 to support max-width&min-width styles

Source: Internet
Author: User
Tags browsers code control document expression get how to learn

We are writing CSS, often encounter let a picture or a layout can not exceed set a certain width range value, sometimes need to set a minimum width, then by DIVCSS5 for everyone to summarize the solution IE6 not support max-width and do not support Max-width method. Below is the CSS width IE6 support for minimum width and maximum width resolution (you may need to learn more about CSS width knowledge).


IE6 supports maximum width and resolves CSS code:
. Yangshi{max-width:1000px;_width:expression (document.documentelement.clientwidth| | document.body.clientWidth) <1000? " 1000px ":"); Overflow:hidden;}

Description: max-width:1000px; This is IE6 with superior other brand browsers to support maximum range width. and _width:expression (document.documentelement.clientwidth| | document.body.clientWidth) <1000? " 1000px ":"); Overflow:hidden IE6 supports max-width instead of CSS code, but the effect is the same as in other versions of browsers.

Let all browsers support Max-width CSS style code, complete:
Max-width:1000px;_width:expression (document.documentelement.clientwidth| | document.body.clientWidth) <1000? " 1000px ":"); Overflow:hidden; Here's 1000 and 1000px are the numbers you need, note that 3 values are the same.

When setting Max Max-width, don't forget to add overflow:hidden;

2, IE6 support Min-width Solution
IE6 supports minimum width to resolve CSS code:
. Yangshi{min-width:1000px;_width:expression (document.documentelement.clientwidth| | document.body.clientWidth) >1000? " 1000px ":");

Description: min-width:1000px; This is IE6 with superior other brand browsers to support maximum range width. and _width:expression (document.documentelement.clientwidth| | document.body.clientWidth) >1000? " 1000px "" "" "") is to let IE6 support min-width instead of CSS code, but the effect and other versions of the browser the same effect.

Let all browsers support Min-width CSS style code, complete:
Min-width:1000px;_width:expression (document.documentelement.clientwidth| | document.body.clientWidth) >1000? " 1000px ":");
Here's 1000 and 1000px are the numbers you need, note that 3 values are the same.

3, let IE6 support Min-width at the same time support max-width solution
Let IE6 support the minimum width and the maximum width limit setting. This situation we often encounter on the picture control, so that the size of the picture, if too wide, can not exceed a certain range of values, when the small time does not control his method, using CSS code:

_width:expression (This.scrollwidth > 620?) "620px": (This.scrollwidth < 1?) "1px": "Auto"));


Control CSS complete code for Picture:

Img{max-width:620px;_width:expression (This.scrollwidth > 620?) "620px": (This.scrollwidth < 1?) "1px": "Auto");}

This note: The picture can not exceed the width greater than 620px, and not less than 1 pixel width.

Allow all browsers including IE6 browsers to support maximum width and minimum width div CSS code:
. yangshi{max-width:620px;min-width:1px;_width:expression (This.scrollwidth > 620?) "620px": (This.scrollwidth < 1?) "1px": "Auto");}

Related Article

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.