在鼠标悬停时更改文本的颜色 [英] to chane colour of text on mouseover
问题描述
不起作用:-onmouseover ="this.bgColor =" gold;"请提出
ANDHRA PRADESH |
---|
ARUNACHAL PRADESH |
ASSAM |
BIHAR |
Not working :- onmouseover="this.bgColor=''gold'';" please suggest
STATE |
---|
ANDHRA PRADESH |
ARUNACHAL PRADESH |
ASSAM |
BIHAR |
推荐答案
尝试一下,
Try this,
onmouseover="this.style.color=''gold''"
CSS是答案...
我用这样的东西
CSS is the answer...
I use something like this
.mouseover:hover
{
background-color:Yellow;
color:Blue;
text-decoration:none;
}
.mouseover
{
background-color:Blue;
color:Yellow;
text-decoration:none;
}
您需要告诉您在哪里使用onmouseover. ANDHRA PRADESH,ARUNACHAL PRADESH,ASSAM BIHAR 的名称如何放置在页面中.
您可以使用CSS这样的方式进行操作
You need to tell where you are using the onmouseover. How are the names ANDHRA PRADESH, ARUNACHAL PRADESH, ASSAM BIHAR placed in your page.
You can do that with css something like
a:hover
{
background-color:yellow;
}
<a href="/test.aspx">test</a>
更新
Update
<style type="text/css">
.clstd
{
background-color:red;
}
/*include this in your style must work*/
.clstd:hover
{
background-color:yellow;
}
</style>
您正在使用类(css),并且再次使用内联属性.最好将CSS中的所有内容都包含在内,因为所有td都具有相同的宽度,高度等,而不是为它们中的每一个书写.
You are using a class(css) and again using inline properties. It is good to include everything in your css as all the td''s are having same width, height etc. instead of writing for each of them.
这篇关于在鼠标悬停时更改文本的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!