Let's solve it first min-heigt Bugs of
Everyone who has laid out the CSS Minimum height Min height is a very useful attribute, which can make very short content have a suitable height and make the page look beautiful. But it's a pity IE6 This property is not supported. What shall I do? We can use another way to IE6 There are also Minimum height The effect of the min height attribute.
As we all know, if the content exceeds the height of the element, IE6 will automatically increase the height of the element, even if you explicitly define the height of the element. We can use this bug in IE6 to make IE6 have the effect of minimum height min height attribute. The specific codes are as follows:
height:auto ! important; height:500px; min-height:500px;
Explanation:
1. Because IE6 is right! There is a bug in the important explanation, so it only recognizes the sentence "height: 500px". After exceeding 500px, IE6 will increase the height of the box itself;
2. IE7 and other standards browser All three sentences can be recognized. Although height is defined as 500px, we have height: auto ! important, Therefore, the height of the box can also be automatically increased if the box exceeds 500px.
The max heigt bug is troublesome. There are two solutions jQuery method:
if($.browser.msie&&($.browser.version === "6.0")){$(".entry").each(function()
{if($(this)[0].scrollHeight>500)$(this)
.css({"height":"500px","overflow":"hidden"});});}
Principle:
In IE6, you can set the height to achieve max-height Effect Cycle all to be added max-height The DOM element of the attribute. Judge whether its scrollHeight is greater than the value you want to set Maximum height If it exceeds the limit, set the height to Maximum height , I use [0] here and get the DOM object of instead of jQuery Object.