悬停在按钮上的文字颜色变化(Text color change on hover over butt

2019-06-27 09:54发布

我试图改变悬停按钮中的文本的颜色。

我可以使按钮本身变色,但我想在按钮上的文字改变颜色了。

这是我当前的CSS:

button,
input.button,
a.button,
input[type="submit"] {
background:#2e77ae;
background: -moz-linear-gradient(top, #5590bd, #2e77ae);
background: -webkit-linear-gradient(top, #5590bd, #2e77ae);
background: -o-linear-gradient(top, #5590bd, #2e77ae);
background: -ms-linear-gradient(top, #5590bd, #2e77ae);
background: linear-gradient(top, #5590bd, #2e77ae);
border-color:#2e77ae;}

button:hover,
input.button:hover,
a.button:hover,
input[type="submit"]:hover{

    background:#E6D332;
    background: -moz-linear-gradient(top, #E6D332, #E6D332);
    background: -webkit-linear-gradient(top, #E6D332, #E6D332);
    background: -ms-linear-gradient(top, #E6D332, #E6D332);
    background: linear-gradient(top, #E6D332, #E6D332);
    border-color:#2e77ae;}



button:focus,
input.button:focus,
a.button:focus,
input[type="submit"]:focus { 
    background-color:#E6D332;}

Answer 1:

CSS属性color控制在一般元素的文本颜色。 在你的情况下,改变悬停颜色,使用:hover符;

input[type = "submit"]:hover {
    color: #FF0000;
    //you can add more styles to be applied on hover
}

请注意,您可以和指定使用的颜色rgb(x, y, z)的格式。 这里有一个小的演示来说明: 小链接 。 你可以玩的演示,查看这里的源: 另一个小环节 。

我希望帮助!



Answer 2:

如果你想改变文本的颜色,使用的CSS color属性,如

input[type="submit"]:hover{
   color :#E6D332; 
}


Answer 3:

 p.one{ color: DarkBlue} p.one:hover{ color: yellow} 
 <html> <head> <title>Css Help</title> <head> <body> <p class="one">Example TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample TextExample Text<p> </body> <html> 

这是我做的:

a:hover{
    color: #ffffff;
}

你可以改变“a”到什么,例如一款“P”或与类指定的HTML文件

<p class="one">Example</p>

他们在CSS文件中做的:

p.one:hover{
    color: #ffffff;
}

我希望我能帮助。



Answer 4:

color:#(insert text color)将这个在



文章来源: Text color change on hover over button