Css+div method of changing background color of mouse

Source: Internet
Author: User

The implementation of the background color of the mouse has a lot of methods, today we are introducing the method to implement with Css+div.

 Method One

#div: Hover{background: #000000;}

Explanation: Background discoloration When the mouse passes the element with ID Div

IE6.0, Firefox2.0, Opera 9.23.

  Method Two

<div onmouseover= "this.style.backgroundcolor= ' #F4F9FD" "onmouseout=" this.style.backgroundcolor= ' #FFFFFF ' "> </div>

 Method Three:

<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 ' "" > hahaha haha </div >

The <a> label is OK, but this will cause other <a> labels to also follow the discoloration.

is typically used to define the style of a link, not to define a region. Now commonly used div+css Web pages, Div is to express the meaning of the area, or like to use this, of course, with a table, there will be a simpler way.

In fact, the use of more of the <a> tag is implemented.

<style>
a {color:red; width:100px; height:22px; line-height:22px;}
a:hover {background: #f4f4f4; color: #000;}
</style>

Note: More wonderful articles please pay attention to the triple Web Design Tutorial section.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.