单击后CSS更改按钮样式 [英] CSS change button style after click

查看:648
本文介绍了单击后CSS更改按钮样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道单击按钮后是否可以在css中更改按钮的样式,而不是 element:active
谢谢!

I was wondering if there was a way to change a button's style, in css, after it's been clicked, so not a element:active. Thanks!

推荐答案

如果您正在寻找纯CSS选项,请尝试使用:focus伪类。

If you're looking for a pure css option, try using the :focus pseudo class.

#style  {
    background-color: red;
}

#style:focus {     
    background-color:yellow;    
}

这篇关于单击后CSS更改按钮样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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