2013-04-25 41 views
0

我有一個橫跨頁面的css菜單,並且我有幾塊可以穿過,我希望它能夠在窗口最小化時菜單保持不變並且不會最小化當窗口被最小化時,Css菜單崩潰了

enter image description here

是什麼樣子時,心不是最小

enter image description here

是頁面最小化時,我想它使菜單剛剛被削減了什麼情況的窗口並沒有改革。我也無法弄清楚如何使菜單塊(首頁,排名...)轉到頁的中心,他們留在側

這裏是我的CSS代碼

@charset "UTF-8"; 
/* CSS Document */ 


body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, input,  textarea, blockquote { 
margin: 0; padding: 0; border: 0; 

} 


body { 
font-family: Brixton , sans-serif; font-size: 22px; line-height: 0px; 
// controls the text size, color, font 
} 

nav ul ul { 
display: none; 
//sets menu dislpay setting 
} 

nav ul li:hover > ul { 
    display: block; 
    //displays the block under the main tabs in the menu 
} 


nav ul { 
background: #efefef; 
background: linear-gradient(top, #efefef 0%, #bbbbbb 100%); 
background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%); 
background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%); 
box-shadow: 0px 0px 9px rgba(0,0,0,0.15); 
//change menu background 
padding: 0 20px; 
list-style: none; 
position: relative; 


} 
nav ul:after { 
    content: ""; clear: both; display: block; 
    //displays the background 
} 

nav ul li { 
    float:left; 
    //decides which side the menu is on 
} 
    nav ul li:hover { 
     background: #4b545f; 
     background: linear-gradient(top, #4f5964 0%, #5f6975 40%); 
     background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%); 
     background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%); 
     //changes the color of the menu when hovered over 
    } 
     nav ul li:hover a { 
      color: #fff; 
     } 

    nav ul li a { 
     display: block; padding: 25px 53px; 

     color: #007FFF; text-decoration: none; 
    } 


nav ul ul { 
    background: #5f6975; border-radius: 0px; padding: 0; 
    position: absolute; top: 100%; 
} 
    nav ul ul li { 
     float: none; 
     border-top: 1px solid #6b727c; 
     border-bottom: 1px solid #575f6a; position: relative; 
    } 
+0

可能只是需要菜單容器上的寬度 – Huangism 2013-04-25 20:31:19

回答

2

如果你希望它始終相同,那麼你需要在導航元素上指定一個寬度。

nav { width : 960px; } 

這應該阻止它。

相關問題