We know that in the Web page layout, there are some special circumstances we can not directly use the external CSS style to control the div style, such as a set a:hover, then we do not apply CSS style to change the mouse hover style?
You can use onmouseover (mouse over target) and onmouseout (after moving the mouse pointer) to set the hover style for a label or other HTML tag.
You can use the label directly, regardless of a tag, span tag, div tag, etc.
<a href= "http://www.php.cn/" style= "color: #00F; Text-decoration:none "
onmouseover= "this.style.color= ' #F00 '; this.style.textdecoration= ' underline '"
onmouseout= "this.style.color= ' #00F '; this.style.textdecoration= ' None '" >DIV</a>
The above sets the default style for a hyperlink code, moves the mouse over the target, and then moves the mouse over the target style. Feature code is longer.
Important note: In order to see the same as the default style when the mouse is moved, it is often necessary to set the default CSS style directly to the label using style and keep the same CSS style as the onmouseout setting. Prevent the initial state object style from being different from the style after the mouse has been moved off the object.
As above code:
style= "COLOR: #00F; Text-decoration:none " and onmouseout=" this.style.color= ' #00F '; this.style.textdecoration= ' None ' "
Sets the default font color #00f and does not display underscores.
To implement hover style setup methods with regular hover and without external hover, the case is as follows
Complete General external CSS Case presentation code:
<! DOCTYPE html>
HTML code and browser effect illustration
DIV css default and mouse hover browser test effect
Default and mouse hover browser test effect
External CSS style conversion after HTML source code
<! DOCTYPE html>