The action keyword in CSS is used to define the behavior when the mouse hovers or activates an element. Syntax: element:action { style-property: value; }. It can be applied to the :hover and :active pseudo-classes to create interactive effects such as changing the appearance of elements, showing hidden elements, or starting animations.
Usage of action in CSS
The action keyword is used in CSS to define mouseover and activation The behavior of the element. It specifies the style to be applied when the specified event occurs.
Syntax:
<code>element:action { style-property: value; }</code>
Events:
Usage:
# The ##action keyword can be used to create various interactive effects, such as:<code>button:hover { background-color: #00FF00; }</code>
<code>a:active { border: 1px solid #FF0000; }</code>
<code>h1:hover { font-size: 1.5em; font-weight: bold; }</code>
<code>.hidden:hover { display: block; }</code>
<code>.my-element:active { animation: my-animation 2s infinite; }</code>
Note:
The above is the detailed content of How to use action in css. For more information, please follow other related articles on the PHP Chinese website!