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;
}
but how can I select the mousedown? I want something like this:
button:mousedown{
//some styling
}
thanks
This question is related to
html
css
css-selectors
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.
Pro-tip Note: for some reason, CSS syntax needs the :active
snippet after the :hover
for the same element in order to be effective
I figured out that this behaves like a mousedown event:
button:active:hover {}
Source: Stackoverflow.com