關於loose.dtd和xhtml1-transitional.dtd等文件類型定義模型中CSS失效的解決辦法。

來源:互聯網
上載者:User
CSS定義在 loose.dtd和xhtml1-transitional.dtd下無效了:

body{
SCROLLBAR-FACE-COLOR: #f2f2f2;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
SCROLLBAR-SHADOW-COLOR: #999999;
SCROLLBAR-3DLIGHT-COLOR: #999999;
SCROLLBAR-ARROW-COLOR: #999999;
SCROLLBAR-TRACK-COLOR: #ff0000;
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;

overflow-y:hidden
}

解決辦法就是

html,body{
SCROLLBAR-FACE-COLOR: #f2f2f2;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;
SCROLLBAR-SHADOW-COLOR: #999999;
SCROLLBAR-3DLIGHT-COLOR: #999999;
SCROLLBAR-ARROW-COLOR: #999999;
SCROLLBAR-TRACK-COLOR: #ff0000;
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;

overflow-y:hidden
}

新的文件類型定義模型使用html 元素作為容器。

類似的還有

document.body.scrollHeight等結果為0

需要使用新的辦法:

var eleHeight
if(document.documentElement)
eleHeight = document.documentElement.scrollHeight
else
eleHeight = document.body.scrollHeight

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.