兼容解决方案: minMax

兼容解决方案: 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";
}
posted @ 2011-11-30 14:10  wkylin  阅读(192)  评论(0编辑  收藏  举报