There are many ways to change the background color of the mouse. Today we will introduce how to use CSS + DIV.
Method 1
Reference content is as follows: # Div: hover {background: #000000 ;} |
Explanation: background color changes when the mouse passes through an element with the id div
IE6.0, Firefox2.0, and Opera 9.23 are unavailable.
Method 2
Reference content is as follows: <Div onmouseover = "this. style. backgroundColor = '# F4F9FD'" onmouseout = "this. style. backgroundColor = '# ffff'"> </div> |
Method 3:
Reference content is as follows: <Style> . D_over {background-color: #307172 ;} . D_out {background-color: # EFEFEF ;} </Style> <Div class = "d_out" onmouseover = "this. className = 'd _ over'" onmouseout = "this. className = 'd _ out'"> Haha </div> |
<A> labels are acceptable. However, this will lead to other labels with <a> labels changing.
Generally, <a> is used to define the link style, not a specific area. Currently, the commonly used div + css web page is used. div indicates the meaning of the Region. You still like to use this type. Of course, if you use table, there will be a simpler method.
In fact, most of them are implemented using the <a> label.
Reference content is as follows: <Style> A {color: red; width: 100px; height: 22px; line-height: 22px ;} A: hover {background: # f4f4f4; color: #000 ;} </Style> |
In this way, all connections in a certain area will change. You can use them in a certain area, and the mouse will change color.