Home >Web Front-end >HTML Tutorial >CSS DIV enables the background to change color when the mouse passes over it_html/css_WEB-ITnose

CSS DIV enables the background to change color when the mouse passes over it_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:32:441302browse

There are many ways to change the background color when the mouse passes over it. Today we will introduce the method using CSS DIV.

Method 1

The following is the quoted content:
以下为引用的内容:

#div:hover{background:#000000;}

#div:hover{background:#000000;}

Explanation: The background changes color when the mouse passes over the element with the id of div

IE6.0, Firefox2.0, Opera 9.23 does not work

Method 2

以下为引用的内容:

The following is the quoted content:

Method 3:

以下为引用的内容:

哈哈哈哈哈

The following is the quoted content:

Hahahahaha< ;/div>

tags are OK, but this will cause other tags with to also change color.

Generally
is used to define the style of the link, not a certain area. Nowadays, div is commonly used in CSS web pages. div means area. I still like to use this. Of course, if you use table, there will be a simpler method.

以下为引用的内容:

In fact, the tag is more commonly used now.

The following is the quoted content:
In this way, as long as it is connected, it will change. You can use it in a certain area, and all the connections in a certain area will change color when the mouse passes.