如何使用jQuery更改文本颜色? [英] How can I change the text color with jQuery?

查看:106
本文介绍了如何使用jQuery更改文本颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将文本悬停在动画上时,肯定会使用jQuery.有没有可以改变颜色或大小的代码?

When I hover a text with animation definitely I will use jQuery. Is there a code that will change the color, or size?

推荐答案

将以下内容放入jQuery mouseover事件处理程序中:

Place the following in your jQuery mouseover event handler:

$(this).css('color', 'red');

要同时设置颜色和大小:

To set both color and size at the same time:

$(this).css({ 'color': 'red', 'font-size': '150%' });

您可以使用.css() jQuery函数设置任何CSS属性.

You can set any CSS attribute using the .css() jQuery function.

这篇关于如何使用jQuery更改文本颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆