IE8 overflow:auto with max-height

后端 未结 8 2056
鱼传尺愫
鱼传尺愫 2020-12-04 11:42

I have an element which may contain very big amounts of data, but I don\'t want it to ruin the page layout, so I set max-height: 100px and overflow:auto

8条回答
  •  不思量自难忘°
    2020-12-04 11:57

    I found this : https://perishablepress.com/maximum-and-minimum-height-and-width-in-internet-explorer/

    This method has been verified in IE6 and should also work in IE5. Simply change the values to suit your needs (code commented with explanatory notes). In this example, we are setting the max-height at 333px 1 for IE and all standards-compliant browsers:

    * html div#division { height: expression( this.scrollHeight > 332 ? "333px" : "auto" ); /* sets max-height for IE */ }

    and this works for me perfectly so I decided to share this.

提交回复
热议问题