2015-01-06 162 views
0

單擊我的標題中的某個導航欄時,它們會在點擊後更改顏色。更奇怪的是,我的主頁和登錄按鈕不會改變,但其他人會這樣做。不希望導航欄鏈接在點擊時改變顏色(懸停效果)

我想知道如何,因爲它加深我的文字太移除這個效果。 (讓我更具體:我不想讓你看到文本後面的話背後的灰色着色)

我的HTML:

<h1 class = "name"><font color = "#3399FF"> Prog-Assist | </font><font size = "12" font color = "#4EA24E"> Where Collaboration is Welcomed</font></h1> 

<div id = "header"> 
    <div id = "gradient"> 
     <div class = "nav"> 

    <!-- container-fluid gives full width container of whole viewport --> 

    <div class = "container-fluid"> 

    <ul id = "nav1" class= "text-left"> 
     <li><a href = "main.html"><strong>Home</a></li> 
     <li><a href = "tech.html">Technologies</a></li> 
     <li><a href = "#">Programs</a></li> 
     <li><a href = "#">Blog</strong></a></li> 
    </ul> 

    <ul id = "nav2" class = "text-right"> 
     <li><a href = "#"><strong>Sign In</a></li> 
     <li><a href = "#">Contact</strong></a></li> 
    </ul> 

    </div><!-- end container-fluid--> 
     </div><!--end nav--> 
    </div> 
</div> <!-- end header --> 

我的CSS:

h1.name{ 

/*font-family: Lato, 'Courier Bold', sanserif;*/ 
font-family: 'KOMIKAX_'; 
src: url(KOMIKAX_.tff); 
font-weight: bold; 
font-variant: small-caps; 
    font-size: 60px; 
color: "red"; 
margin-left: 30px; 
text-shadow: 0 0 1px black; 

} 

#header { 
margin-left: 30px; 
width:cover; 
} 

#gradient { 
    height: 65px; 
border: 1px solid; 
/* IE 10 */ 
background-image: -ms-linear-gradient(top, #81a8cb 0%, #1947D1 100%); 

/* Firefox */ 
    background-image: -moz-linear-gradient(top, #81a8cb, #1947D1); 

/* Safari & Chrome */ 
    background-image: -webkit-gradient(linear,left bottom,left top, color-stop(0, #1947D1),color-stop(1, #81a8cb)); 

box-shadow: inset 0 0 15px black; 
} 



#nav1 { 

list-style: none; 

} 

#nav2 { 

list-style: none; 

} 

.nav a { 

text-decoration: none; /*remove underline*/ 
text-transform: uppercase; 
color: white; 
font-family: Rockwell, 'Courier Bold', serif; 
font-size: 20px; 
padding-bottom: 15px; 

} 

.nav li { 

display: inline; 
float: left; 
padding: 10px; 


} 

.nav a:visited { 
    text-decoration: none; 
    color: white; 
    font-weight:bolder; 
} 
.nav a:hover { 
    text-decoration: none; 
    color: #A7D1A7; 

} 
.nav a:active { 
    text-decoration: none; 
    color: #19A3FF; 
    font-weight:bolder; 

} 

enter image description here

回答

3
.nav a:visited, .nav a:hover{background-color:transparent; text-decoration:none} 

如果仍然不工作,你可能有某種其他的CSS覆蓋它的頁面,那麼你會使用!重要的黑客攻擊。

.nav a:visited, .nav a:hover{background-color:transparent !important; text-decoration:none} 
+0

謝謝。我想知道是否有一個術語用於使懸停的背景顏色爲空..我會檢查標記這一點,當我被允許(計時器說我必須等待) – narue1992

+0

它明白了。謝謝! – ClosDesign

0

使用css僞類。

/* unvisited link */ 
header a:link { 
    color: #FF0000; 
} 

/* visited link */ 
header a:visited { 
    color: #00FF00; 
} 

/* mouse over link */ 
header a:hover { 
    color: #FF00FF; 
} 

/* selected link */ 
header a:active { 
    color: #0000FF; 
} 
+0

我很抱歉。我的意思是懸停顏色效果。我會改變標題 – narue1992

+0

關於懸停效果可以設置在a:hover –

+0

那麼我如何設置懸停爲「無」?我的問題是刪除它。我當前的代碼對背景顏色沒有任何顏色效果 – narue1992

0

CSS僞類:訪問是用來

a:visited{ text-decoration:none; color:#fff;} 
+0

懸停灰色仍然顯示這種方式。我有一個:已經訪問過,但我沒有在我的圖像中顯示的「背景色」效果 – narue1992