兼容解决方案: minMax

Min Max:

1. 方法:这个东西还是用JS解决吧,除min height CSS还不是那靠谱。
2.min-height:

.min-height:200px;height:auto;
_height:200px; /* hack for ie6 */

3.max Height

function setMaxHeight(elementId, height){
var container = document.getElementById(elementId);
container.style.height = (container.scrollHeight > (height - 1)) ? height + "px" : "auto";
}

4.min Width

function setMinWidth(elementId, width){
var container = document.getElementById(elementId);
container.style.width = (container.clientWidth < width) ? width + "px" : "auto";
}

5.max Width

function setMaxWidth(elementId, width){
var container
= document.getElementById(elementId);
container.style.width = (container.clientWidth > (width - 1)) ? width + "px" : "auto";
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-08-19
  • 2018-12-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-01-05
  • 2022-03-01
  • 2021-12-01
  • 2021-11-18
相关资源
相似解决方案