2013-03-13 50 views
5

オーバーフローしたときにFirefoxのスクロールバーを非表示にするにはどうすればいいですか?Firefoxのスクロールバーが隠されている

:: - webkit-scrollbar { display:none; }

私はこのコードを使用しますが、これはGoogle Chromeでのみ機能します。

help guy?ありがとうございました!

は私が

オーバーフロー使用

更新:隠されたが、

マイページをフッタに進めることはできません。

<html> 
<head> 
<link rel="stylesheet" href="css/style.css" type="text/css" /> 
</head> 

<body> 

<div id="pageWrapper"> 
    <header></header><!--end of header--> 

    <nav> 
     <ul> 
      <li><a href="#">Home</a></li>| 
      <li><a href="#">Services</a></li>| 
      <li><a href="#">Gallery</a></li>| 
      <li><a href="#">FAQ</a></li>| 
      <li><a href="#">About Us</a></li>| 
     </ul> 
    </nav><!--end of nav--> 

    <aside> 

    </aside><!--end of aside--> 

    <section> 
    </section><!--end of section--> 
    <footer>All Right Reserved 2013.</footer><!--end of footer--> 
</div><!--end of pageWrapper--> 

</body> 
</html> 

私のcss

/*----- Reset ----*/ 
html, body, div, span, object, h1, h2, h3, h4, h5, h6, p, 
blockquote, pre, a, address, code, img, small, strong, 
dl, dt, dd, ol, ul, li, fieldset, form, label{ 
margin:0; 
padding:0; 
border:0; 
outline:0; 
font-size:100%; 
vertical-align:baseline; 
background:transparent; 
} 
body{ 
line-height:1.5; 
font-family: helvetica, arial, sans-serif; 
} 

body,html{ 
    height:100%; 
    background-color:whitemsoke; 
} 

ol, ul{ 
list-style:none; 
} 

/* ---- END OF RESET --- */ 
#pageWrapper{ 
    width:965px; 
    height:100%; 
    margin:auto; 
    box-shadow:1px 1px 17px black; 
    overflow:hidden; 
} 
::-webkit-scrollbar { 
    display:none; 
} 
header{ 
    background-color: #D4E7ED; 
    height:200px; 
} 
nav{ 
    text-align:center; 
    background-color:#003366; 
    padding:10px; 
} 
nav ul li{ 
    display:inline; 
    padding:20px; 
} 
nav ul li a{ 
    text-decoration:none; 
    color:whitesmoke; 
} 
nav ul li a:hover{ 
    text-decoration:underline; 
} 
aside{ 
    width:200px; 
    background-color:#666666; 
    height:100%; 
    overflow:hidden; 
    float:left; 
    margin:0 auto -20px 0; 
} 
section{ 
    background-color:#CCCCCC; 
    height:100%; 
    margin:0 auto -20px 0; 
    overflow:hidden; 
} 
footer{ 
    background-color:#003366; 
    height:20px; 
    position:relative; 
} 
+2

なぜ 'overflow:hidden'を使わないのですか? –

+0

私はそれを試してみるよ、ありがとう。オーバーフローを使用するとFirefoxでスクロールバーを非表示にする方法はありません:auto? –

+0

それは機能しません私は私のフッタを見ることができません:| –

答えて

10

私は、Firefoxに固有の何かを見つけることができませんでした。私も::-webkit-scrollbar { display:none }と同等のものを探していました。私が見つけた何

は、しかし、一般的なクロスブラウザのソリューションです:

<div class="outer"> 
    <div class="inner"> 
     Some content... 
    </div> 
</div> 

<style> 
.outer { 
    overflow: hidden; 
} 
.inner { 
    margin-right: -16px; 
    overflow-y: scroll; 
    overflow-x: hidden; 
} 
</style> 

スクロールバーは、親のdivによって隠されています。

これは、親のdivにoverflow:hiddenを使用する必要がありますが、それ以外の場合は魅力的です。

+0

margin-right:-16pxは非常に賢いです! – duhaime

+0

このオプションを選択すると、各ブラウザでスクロールバーのサイズが異なりますので、タッチスクリーンデバイスに特に注意してください。 – Grirg

+0

内部divの内容が画面の幅より長い場合、FF 56で動作しません –

関連する問題