2014-09-23 48 views
-1

我有與CSS的顏色問題。當我把HREF放在鏈接中時,字體顏色會變成灰色,但是在CSS類中沒有灰色。 代碼如下。CSS問題與HTML

HTML 
<a class="css_button_addHRS" >ADD HOURS</a> 

當我在標籤中添加href時,它將ADD HOURS的字體顏色更改爲灰色,它應該是白色的。任何想法?在CSS中沒有其他灰色的A。

CSS 


.css_button_addHRS { 
     font-size: 14px; 
     font-family: Arial; 
     font-weight: bold; 
     text-decoration: inherit; 
     -webkit-border-radius: 8px 8px 8px 8px; 
     -moz-border-radius: 8px 8px 8px 8px; 
     border-radius: 8px 8px 8px 8px; 
     border: 1px solid #d02718; 
     padding: 9px 18px; 
     text-shadow: 1px 1px 0px #810E05; 
     -webkit-box-shadow: inset 1px 1px 0px 0px #f5978e; 
     -moz-box-shadow: inset 1px 1px 0px 0px #f5978e; 
     box-shadow: inset 1px 1px 0px 0px #f5978e; 
     cursor: pointer; 
     color: #ffffff; 
     display: inline-block; 
     background: -webkit-linear-gradient(90deg, #c62d1f 5%, #f24537 100%); 
     background: -moz-linear-gradient(90deg, #c62d1f 5%, #f24537 100%); 
     background: -ms-linear-gradient(90deg, #c62d1f 5%, #f24537 100%); 
     background: linear-gradient(180deg, #f24537 5%, #c62d1f 100%); 
     filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#f24537",endColorstr="#c62d1f"); 
    } 

     .css_button_addHRS:hover { 
      background: -webkit-linear-gradient(90deg, #f24537 5%, #c62d1f 100%); 
      background: -moz-linear-gradient(90deg, #f24537 5%, #c62d1f 100%); 
      background: -ms-linear-gradient(90deg, #f24537 5%, #c62d1f 100%); 
      background: linear-gradient(180deg, #c62d1f 5%, #f24537 100%); 
      filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#c62d1f",endColorstr="#f24537"); 
      text-decoration: none; 
      color: #ffffff; 
     } 

     .css_button_addHRS:active { 
      position: relative; 
      top: 1px; 
      color: #ffffff; 
     } 

這個CSS創建一個按鈕,用紅色和白色字體顏色圓角。幫助將不勝感激。

+0

看起來對我來說很白http://jsfiddle.net/fLy1mpLw/ – andrew 2014-09-23 13:06:49

回答

1

這聽起來像是一個:visited鏈接的默認樣式。

你應該添加此解決它:

.css_button_addHRS:visited { 
    color: #ffffff; 
} 
3

您必須指定此。該頁面的鏈接將自動更改爲鏈接默認的顏色,所以你必須補充一點:

<style type="text/css"> 

    a:link, 
    a:visited, 
    a:hover, 
    a:active{ 
     color: #FFF; 
     text-decoration: none; 
    } 
</style> 

你用代碼編輯器是什麼?

+0

我使用dreamweaver cs6 – Alz 2014-09-24 11:18:56

+0

這工作:D謝謝你的伴侶。我使用.css_button_addHRS:鏈接{它工作。 – Alz 2014-09-24 11:23:02

0

link,visitedactive顏色(如果未指定)採用瀏覽器設置的默認值,並且它在不同的瀏覽器中有所不同。既然你已經指定了顏色.css_button_addHRS類的灰色肯定會出現,當你訪問過的鏈接,所以你必須指定一個顏色訪問過的鏈接,e.g:

.css_button_addHRS:visited{ 
    color: #ffffff; 
} 

希望它是非常有用的!