2014-09-23 90 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; 
} 

希望它是非常有用的!