且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CSS max-height和max-width同时在IE8中不起作用?

更新时间:2023-10-30 23:08:40

IE8在理解 max-width max-height 时遇到问题>当没有宽度高度设置时。从你的问题和你的代码来看,我认为你更喜欢而不是来使用这些属性,但在这种情况下,如果你想让它在IE8中工作,你可能没有选择。

IE8 has problems with understanding max-width and max-height when there is no width or height set. Judging from your question and your code I take you'd prefer not to use those properties, but in this case you might not have a choice if you want to get it working in IE8.

尝试使用特定于IE8的 @media 查询:

Try using an IE8 specific @media query:

@media \0screen {
  .Popup {
    height: 500px;
    width: 500px;
  }
}

或者,输入宽度 height 类中的属性,并将值 \9 附加到目标IE6及以上:

Alternatively, put the width and height properties in the class and append the values with \9 to target IE6 and up:

.Popup
{
  border: solid 1px #c0c0c0;
  background:#FFFFFF;
  padding: 0px 10px 10px 10px;
  position:absolute;
  padding-top: 10px;
  height: 500px\9;
  width: 500px\9;
  max-height: 90%; overflow: auto;
  max-width: 90%; overflow: auto;
}