2017-06-02 54 views
0

以下是我的代码。当我将鼠标悬停在搜索按钮上时,我正在改变文字效果。我将按钮背景保持不变,只是在悬停时尝试更改文本的颜色。我不确定我错过了什么。有没有更简单的方法来实现这一目标?该按钮只保留预先悬停的颜色。我没有想法。CSS:不能得到:悬停工作,我错过了什么?

.header_search #search-submit { 
    width: 80px; 
    height: 35px; 
    margin: 0 -83px 0 0; 
    background: #ff9105; 
    border: 2px solid black; 
    border-left: none; 
    font-size: 14px; 
    color: #008b95; 
    -webkit-border-radius: 0 5px 5px 0; 
      border-radius: 0 5px 5px 0; 
} 

    {{ trans_fast }} 

.header_search #search-submit:hover { 
    background: #ff9105; 
    color: white 
} 
+0

你的CSS语法不正确。缺少分号和什么是“{{trans_fast}}”? – Raptor

回答

0

添加;color: white

.header_search #search-submit:hover { 
    background: #ff9105; 
    color: white; 
} 
2
.header_search #search-submit { 
    width: 80px; 
    height: 35px; 
    margin: 0 -83px 0 0; 
    background: #ff9105; 
    border: 2px solid black; 
    border-left: none; 
    font-size: 14px; 
    color: #008b95; 
    -webkit-border-radius: 0 5px 5px 0; 
    border-radius: 0 5px 5px 0; 
} 

/* dont know about this "{{ trans_fast }}" */ 

.header_search #search-submit:hover { 
    background: #ff9105; 
    color: white; 
} 

末编辑这里之后,它看起来应该还行,trans_fast是一个非常未知的概念给我。你的一些CSS属性是垂直的,有些是水平的。出于语法目的,请尝试一种或另一种,但不能同时使用两种。加号(你忘了颜色的分号)

+0

如果trans_fast是有用的,拿出注释和单词来使用它,我只做了它,因为我担心这会成为问题。 –