CSS achieves the maximum and minimum width/height of IE6

Source: Internet
Author: User

-Maximum width/height

IE6 cannot read the max-width and max-height attributes, but ie supports its own JavaScript attribute expression,
For example
Div {width: expression (250 + "PX")} And Div {widt: 250px}

It is consistent in IE's read!

However, If you disable javascript in your browser, your writing will fail.
Therefore, we use another write method to solve the above failure.

* HTML Div # Division {
Width: expression (document. Body. clientwidth> 776? "777px": "Auto");/* sets max-width for IE to set the widest value for IE */

Max-width: 777px;/* This sets the max-width value for all standards-compliant browsers */
}

 

* HTML Div # Division {
Width: expression (document. Body. clientwidth> (500/12) * parseint (document. Body. currentstyle. fontsize )? "33em": "Auto ");
Max-width: 33em;/* This sets the max-width value for all standards-compliant browsers */
}

The minimum width and height can be achieved in a similar way, as shown below:

* HTML Div # Division {
Width: expression (document. Body. clientwidth <334? "333px": "Auto");/* Set Min-width for IE to set the minimum width for IE */
Min-width: 333px;/* sets Min-width value for all standards-compliant browsers */
}

 

* HTML Div # Division {
Height: expression (this. scrollheight> 332? "333px": "Auto"); * sets max-height for IE sets the maximum height for IE */
Max-Height: 333px;/* sets max-height value for all standards-compliant browsers */
}

 

* HTML Div # Division {
Height: expression (this. scrollheight: <334? "333px": "Auto");/* sets Min-height for IE to set the height minimum */
Min-Height: 333px;/* sets Min-height value for all standards-compliant browsers */
}

II. The minimum width/height can be implemented using the above method, but there is a simpler method.

Div # Division {

Min-width: 300px;

Width: Auto! Important;

Width: 300px;

}

Note that the order cannot be changed

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.