What is the mouse down selector in CSS?

后端 未结 4 612
既然无缘
既然无缘 2021-01-31 00:44

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 styl

相关标签:
4条回答
  • 2021-01-31 01:17

    I figured out that this behaves like a mousedown event:

    button:active:hover {}
    
    0 讨论(0)
  • 2021-01-31 01:27

    I recently found out that :active:focus does the same thing in css as :active:hover if you need to override a custom css library, they might use both.

    0 讨论(0)
  • 2021-01-31 01:28

    I think you mean the active state

     button:active{
      //some styling
     }
    

    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 */
    

    See also: http://www.w3.org/TR/selectors/#the-user-action-pseudo-classes-hover-act

    0 讨论(0)
  • 2021-01-31 01:35

    Pro-tip Note: for some reason, CSS syntax needs the :active snippet after the :hover for the same element in order to be effective

    http://www.w3schools.com/cssref/sel_active.asp

    0 讨论(0)
提交回复
热议问题