很多时候我们需要对IE6的bug写一些hack,如max-height,absolute元素高度100%等。

css里面的 expression(表达式)和js里面的差不多,如:

获取当前元素的高度:

.box{
    height:expression(this.offsetHeight);
}

我们也可以获取到本身高度后再加减某个高度:

.box{
    height:expression(this.offsetHeight-30);
}

获取滚动的高度:

top:expression(eval(document.documentElement.scrollTop))}

获取父元素的高宽:

width:expression(this.parentNode.offsetWidth); 
height:expression(this.parentNode.offsetHeight); 

  

相关文章:

  • 2021-08-19
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2021-11-10
  • 2021-06-02
相关资源
相似解决方案