2015-11-04 80 views
0

我遇到以下列表的問題。問題是,當我懸停在每個元素上時,文本顏色不會改變。懸停在CSS中不改變顏色屬性

List

我的CSS代碼應該改變顏色,但我不知道爲什麼它不是。

ul { 
    padding: 0; 
    list-style: none; 
    background: white; 
    opacity: 0.8; 
    position: absolute; 
    top: 18%; 
    left: 1.6%; 
    width: 96.5%; 
    -webkit-box-shadow: 0 0 10px #aeaeae; 
    -moz-box-shadow: 0 0 10px #aeaeae; 
    box-shadow: 0 0 10px #aeaeae; 
} 

li { 
    display: inline-block; 
    text-align: center; 
    width: 16.66685471%; 
    padding-top: 0.8%; 
    padding-bottom: 0.8%; 
} 

li a { 
    text-decoration: none; 
    color: black; 
} 

li:hover { 
    text-decoration: none; 
    background-color: #FFD800; 
    color: white; 
    display: inline-block; 
    transition: 0.5s; 
} 

li a:hover { 
    text-decoration: none; 
    background-color: #FFD800; 
    color: white; 
} 

玉文件:

  ul 
       li 
        a(href="/Catalogo") CATÁLOGO      
       li 
        a(href="/Noticias") NOTICIAS 
       li 
        a(href="/Proyectos") PROYECTOS 
       li 
        a(href="/Eventos") EVENTOS 
       li 
        a(href="/Acerca") ACERCA DE 
       li 
        a(href="/Contacto") CONTACTO 

在此先感謝。

回答

6
li:hover a { 
    text-decoration: none; 
    background-color: #FFD800; 
    color: white; 
} 
+0

如果這不起作用,它很可能意味着你有一些其他的CSS選擇器適用於具有更高特異性值的鏈接。例如:nav.primary ul li a {color:black} – partypete25