2013-12-13 44 views
0

所以我用div製作了這個頂級菜單,因爲這傢伙想要盒子,並且希望它們的尺寸完全相同,而不管文字是什麼。它看起來很好,但不會激活財產或懸停。請幫忙。我的<a>不工作,也不是懸停屬性

的CSS是

.headerbottomcontainer { 
    width: 100%; 
    max-width: 980px; 
    margin-left: auto; 
    margin-right: auto; 
    min-height: 78px; 
    border: 1px dotted #27c3ed; 
} 

.headerbottomleft { 
    width: 290px; 
    float: left; 
    padding-left: 5px; 
    padding-right: 5px; 
    border: 1px dotted #F36; 
    min-height: 66px; 
} 

.headerbottomright { 
    width: 640px; 
    margin-left: 15px; 
    min-height: 66px; 
    float: left; 
    border: 1px dotted #27c3ed; 
} 


.headerbottomrighttop { 
    height: 28px; /*Change to 30 when remove borders*/ 
    width: 100%; 
    border: 1px dotted #093; 
} 

.headerbottomrightbottom { 
    height: 28px; /*Change to 30 when remove borders*/ 
    width: 100%; 
    margin-top: 10px; 
    border: 1px dotted #C60; 
    } 

.navbuttonfirst { 
    width: 122px; 
    height: 16px; /*Change to 30 when remove borders*/ 
    font-size: 16px; 
    color: #fff; 
    border: 1px solid #f00; 
    float: left;  
    text-align: center; 
    padding-top: 5px; 
    padding-bottom: 7px; 
    border-radius: 3px; 

} 

.navbutton { 
    margin-left: 5px; 
    width: 122px; 
    height: 16px; /*Change to 30 when remove borders*/ 
    font-size: 16px; 
    color: #fff; 
    border: 1px solid #f00; 
    float: left;  
    text-align: center; 
    padding-top: 5px; 
    padding-bottom: 7px; 
    border-radius: 3px; 
} 

.navbutton:hover{ 
    background-color:#f00; 
} 

而HTML是

<div class="headerbottomcontainer"> 
     <div class="headerbottomleft"> 
     </div> 

     <div class="headerbottomright"> 
      <div class="headerbottomrighttop"> 

       <div class="navbuttonfirst"> 
        <a href="http://www.jetnightclub.com/events.html">Events</a> 
       </div> 
       <div class="navbutton"> 
       <a href="photos.html">Photos</a> 
       </div> 
       <div class="navbutton"> 
        <a href="videos.html">Videos</a> 
       </div> 
       <div class="navbutton"> 
        <a href="ourclub.html">Club Info</a> 
       </div> 
       <div class="navbutton"> 
        <a href="contact.html">Contact</a> 
       </div> 

      </div> 

      <div class="headerbottomrightbottom"> 
       <div class="navbuttonfirst"> 
        <a href="birthdays.html">Birthdays</a> 
       </div> 
       <div class="navbutton"> 
        <a href="barhop.html">Bar Hop</a> 
       </div> 
       <div class="navbutton"> 
        <a href="newyears2013-2014.html">New Year's</a> 
       </div> 
       <div class="navbutton"> 
        In the mix 
       </div> 
       <div class="navbutton"> 
        Downloads 
       </div> 
      </div> 
     </div> 
    </div> 
+5

我沒有看到':hover'在你的CSS中的任何地方,爲此目的考慮使用'ul'和'li' e嵌套在'nav'下的遊戲庫 –

+0

add:懸停在你的navbutton .navbutton:hover { \t background-color:#333333; \t顏色:#006633; } – Karuppiah

+0

是的,我把徘徊出去,因爲它沒有工作對不起,將加回來.....仍然沒有工作....任何想法,爲什麼我的不工作/ – user3098121

回答

0

嘗試

.navbutton:懸停{ 背景顏色:#FF0000; }

.navbuttonfirst:hover { background-color:#FF0000; }

把裏面,即... 你必須像這樣添加懸停效果。原諒我的顏色選擇。

+0

謝謝你,我知道這部分,但由於某種原因不能在現場工作 – user3098121

0

你可以添加a:hover或特定類.classname:hover

a:hover{ 

    color:red; 
} 

CSS未訪問,訪問,懸停,並積極聯繫,

a:link {color:green;} 
a:visited {color:green;} 
a:hover {color:red;} 
a:active {color:yellow;} 
+0

謝謝。我知道這部分,但由於某種原因,它不適用於現場網站.. – user3098121

0

您可以使用以下代碼..

.navbuttonfirst a { 
    width: 122px; 
    height: 16px; /*Change to 30 when remove borders*/ 
    font-size: 16px; 
    color: #fff; 
    border: 1px solid #f00; 
    float: left;  
    text-align: center; 
    padding-top: 5px; 
    padding-bottom: 7px; 
    border-radius: 3px; 

} 

.navbutton a{ 
    margin-left: 5px; 
    width: 122px; 
    height: 16px; /*Change to 30 when remove borders*/ 
    font-size: 16px; 
    color: #fff; 
    border: 1px solid #f00; 
    float: left;  
    text-align: center; 
    padding-top: 5px; 
    padding-bottom: 7px; 
    border-radius: 3px; 
} 

.navbutton a:hover{ 
    background-color:#f00; 
}