CSS中的鼠标按下选择器是什么? [英] What is the mouse down selector in CSS?

查看:996
本文介绍了CSS中的鼠标按下选择器是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到按钮和其他元素具有默认样式,其行为分为3个步骤:普通视图,悬停/焦点视图和mousedown/单击视图,在CSS中,我可以像这样更改普通视图和悬停视图的样式:

I have noticed that buttons and other elements have a default styling and behave in 3 steps: normal view, hover/focus view and mousedown/click view, in CSS I can change the styling of normal view and hover view like this:

button{
  background:#333;
  color:#FFF;
}

button:hover{
  background:#000;
  color:#EEE;
}

但是我该如何选择mousedown?我想要这样的东西:

but how can I select the mousedown? I want something like this:

button:mousedown{
  //some styling
}

谢谢

推荐答案

我认为您的意思是活跃状态

I think you mean the active state

 button:active{
  //some styling
 }

这些是链接在CSS中可能具有的所有伪状态:

These are all the possible pseudo states a link can have in CSS:

a:link {color:#FF0000;}    /* unvisited link, same as regular 'a' */
a:hover {color:#FF00FF;}   /* mouse over link */
a:focus {color:#0000FF;}   /* link has focus */
a:active {color:#0000FF;}  /* selected link */
a:visited {color:#00FF00;} /* visited link */

另请参见: http://www.w3.org/TR/selectors/#the-user-action-pseudo-classes-hover-act

这篇关于CSS中的鼠标按下选择器是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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