gpt4 book ai didi

javascript - 悬停时更改 div 标签内文本的字体颜色

转载 作者:行者123 更新时间:2023-11-28 15:49:44 24 4
gpt4 key购买 nike

当用户将鼠标悬停在文本上时,我正在尝试更改文本的颜色并在其下划线。

我尝试了以下方法,但它不起作用。我确实在整个互联网上寻找解决方案,但没有找到适合我特定需求的解决方案。

<style type="text/css">
.container{ width: 100px; float: left; background: #e2edf9; overflow: hidden; }
.content {width: 10px; height:20px; cursor: pointer; color: black; }
.content:hover{color: orange;}
</style>

<div class="container">
<div class="content" onclick="search(this)" >**EWR**</div>
<div class="content" onclick="search(this)" >**NRT**</div>
</div>

最佳答案

CSS:

.container{ width: 100px; float: left; background: #e2edf9; overflow: hidden; }
.content {width: 10px; height:20px; cursor: pointer; color: #000000; }
.content:hover{color: #FFA500; text-decoration: underline;}

并非所有浏览器都接受文字作为颜色尝试使用十六进制代码或 rgb()。

参见:http://jsfiddle.net/davcpas123/3S4xN/2/

更新:

Strange 对我来说还不错:

enter image description here

关于javascript - 悬停时更改 div 标签内文本的字体颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12377786/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com