CSS how to control the mouse across the change picture?

Source: Internet
Author: User
When we use the mouse to swipe through the web, will always be a sudden change of the image to attract attention, which greatly improve the user experience, resulting in higher efficiency. Then this article is mainly introduced with CSS how to control the mouse across the changes in the picture, there is a need for friends to refer to.

CSS controls the specific code example that transforms a picture when the mouse is over:

<style type= "Text/css" >    . demo {        width:500px;        height:400px;        Text-decoration:none;        Display:block;        Background-image:url (1.png);        background-position:0px 0;        background-repeat:no-repeat;    }    . demo:hover,.demo:active {        background-position:0 0;        Background-image:url (2.png);    } </style> 


Note:

The Css:hover selector is used to select the element on which the mouse pointer floats and is available for all elements, not just links.

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.