2012-12-27 64 views
0

我的sidenav中的內容不在其容器內。它在jsfiddle中看起來不錯,但不在我的瀏覽器中。 (火狐17.1 Ubuntu的量子理論) jsfiddlesidenav內容不對齊

<div id="page-wrapper"> 
    <div id="header"></div> 
    <div id="content-wrapper"> 
     <div id="content"> 
      <h1>Title</h1>&nbsp 
      <p>lipsum...</p> 
     </div><!-- END content -->   

<div id="menu-wrap"> 
    <div id="menu"> 
      <ul> 
      <li><a href="#">index</a> 
        <ul> 
         <li><a href="#">Item one</a></li> 
         <li><a href="#">Item two</a></li> 
         <li><a href="#">Item three in the list</a></li> 
        </ul> 
       </li> 
      </ul> 
    </div><!-- END menu --> 
</div><!-- END menu-wrap --> 

    </div><!-- END content-wrap --> 
    <div id="footer"></div> 
</div><!-- END page-wrapper --> 

的CSS

h1 { 
font-size:34px; 
text-align: center;  
} 

#header { 
    height: 35px; 
    width: 100%; 
    background-color: #336699; 
    position: fixed; 
    top: 0px; 
    z-index: 10; 
} 

#content-wrapper { 
    position: absolute; 
    top: 70px; 
    bottom: 50px; 
    left: 0px; 
    right: 0px; 
} 

#content { 
    width: 90%; 
    float: right; 
    padding-bottom: 50px; 
    padding-right: 30px; 
    line-height: 2em;  
} 

#menu ul li { 
list-style-type: none; 
} 

#menu ul ul { 
    display:none; 
    position: fixed; 
} 

#menu ul ul a { 
} 

#menu ul a { 
    text-decoration: none; 
    color: black; 
} 

#menu ul li:hover ul { 
    display:block; 
    left: 0; 
    line-height: 20px; 
    width: 170px; 
    height: 400px; 
    background: #CCC; 
    border-top-right-radius:1em; 
    border-bottom-right-radius:1em; 
    padding-left: 22px; 
    text-align: left; 
    line-height: 35px; 
    padding-top:20px; 
    font-size: 14px; 
} 

#menu-wrap { 
    position:fixed; 
    top:50px; 
    width: 52px; 
    height: 22px; 
    border-top-right-radius: 6px; 
    border-bottom-right-radius:6px; 
    background: rgba(181,181,181,0.5); 
    text-align: center; 
    padding-top: 3px; 
    z-index: 0; 
} 

#footer { 
    height: 10px; 
    width: 100%; 
    background-color: green; 
    position: fixed; 
    bottom: 0px; 
} 
+0

原因之一,我看到'#菜單包裹{寬度:52px;這可能會導致問題。我沒有仔細觀察它,但它可能不會在集裝箱外膨脹,因爲集裝箱的寬度太狹窄了。也許使用'#menu-wrap'更動態的寬度? – Mike

+0

有什麼問題? – Chanckjh

回答

0

這是所有你需要:

ul {padding: 0; margin: 0;} 
+1

順便說一下,我認爲這是在你的主人,但不要忘了添加這個: '身體{填充:0; margin:0;}' – Riskbreaker

+0

'ul {padding:0; margin:0;}'和'body {padding:0;保證金:0;}'使它工作。謝謝IC – mike

+0

快樂編碼沒問題:) – Riskbreaker