1、完全隱藏滾動條
在<boby>里加入scroll="no",可隱藏滾動條;
在<boby>里加入scroll="no",可隱藏滾動條;
<boby scroll="no">
或是<body style="overflow:hidden">
2、自動顯示,在不需要時隱藏
指當瀏覽器窗口寬度或高度大於頁面的寬或高時,不顯示滾動條;反之,則顯示;
指當瀏覽器窗口寬度或高度大於頁面的寬或高時,不顯示滾動條;反之,則顯示;
<boby scroll="auto">
3、樣式表方法
<body style="overflow-x:hidden">,可隱藏水平滾動條;
<body style="overflow-x:hidden">,可隱藏水平滾動條;
<body style="overflow-y:hidden">,可隱藏垂直滾動條。
有解釋說,這種方法在頁面頭部爲:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
"http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
這種兼容模式下是不行的,我沒試過,而這種解釋的解決方法是:
被包含頁面里加入
被包含頁面里加入
<style>
html { overflow-x:hidden; }
</style>
html { overflow-x:hidden; }
</style>
而同樣body{ overflow-x:hidden; }在標準 DTD 下是不可以的。
另一種方法:
<style type="text/css">
body {
overflow-x:hidden; /*隱藏水平滾動條*/
overflow-y:hidden; /*隱藏水平滾動條*/
}
</style>
body {
overflow-x:hidden; /*隱藏水平滾動條*/
overflow-y:hidden; /*隱藏水平滾動條*/
}
</style>
此方法在頁面頭部爲:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
這種兼容模式下也是不行的。
<style type="text/css">
html {
overflow-x:hidden; /*隱藏水平滾動條*/
overflow-y:hidden; /*隱藏水平滾動條*/
}
</style>
html {
overflow-x:hidden; /*隱藏水平滾動條*/
overflow-y:hidden; /*隱藏水平滾動條*/
}
</style>