DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> CSS入門知識 >> DIV十CSS布局 >> 布局實例
CSS 返回頂部圖標固定在瀏覽器右下角:兼容 IE6 的寫法
編輯:布局實例     

在舊專案中,若要把返回頂部圖標固定在瀏覽器右下角,同時兼容 IE6,常會看到使用 CSS expression 的寫法。這種方式只適合維護老舊系統,現代專案建議改用 position: fixed 或 JavaScript 輔助。

#e_float {
  _position: absolute;
  _bottom: auto;
  _right: 50%;
  _margin-right: -536px;
  _top: expression(eval(document.documentElement.scrollTop + document.documentElement.clientHeight - this.offsetHeight - (parseInt(this.currentStyle.marginTop, 10) || 0) - (parseInt(this.currentStyle.marginBottom, 10) || 0)));
}

其中底線前綴 _ 是針對 IE6 的 hack,expression 則讓元素位置能隨捲動重新計算。由於效能與維護性不佳,新專案不建議使用。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved