css hover is a selector used to select the element on which the mouse pointer floats. The setting syntax of this selector is such as "a:hover{background-color:yellow;}".
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
:hover selector is used to select the element on which the mouse pointer is floating.
Tip: The :hover selector can be used on all elements, not just links.
Tips: The :link selector sets the style of links pointing to pages that have not been visited, the :visited selector is used to set links to pages that have been visited, and the :active selector is used for active links.
Note: In the CSS definition, :hover must be placed after :link and :visited (if present) for the style to take effect.
Example
Select the element the mouse pointer is floating on and set its style:
Code:
<!DOCTYPE html> <html> <head> <style> a:hover { background-color:yellow; } </style> </head> <body> <a href="http://www.w3school.com.cn">W3Sschool</a> <a href="http://www.google.com">Google</a> <a href="http://www.wikipedia.org">Wikipedia</a> <p><b>注释:</b>:hover 选择器鼠标指针在其上浮动的链接设置样式。</p> </body> </html>
Effect:
For more detailed HTML/CSS knowledge, please visit the CSS Video Tutorial column!
The above is the detailed content of How to set up css hover. For more information, please follow other related articles on the PHP Chinese website!