Changing the color and black/white of each part of the photo

Source: Internet
Author: User
The color and black/white of each part of the photo are exchanged

<Style> ul {width: 300px; height: 300px; margin: 0px auto; padding: 0px; overflow: hidden; background: transparent url (/study/2006_12_25/2006122516414543849.jpg)} li {list-style-type: none; width: 100px; height: 100px; float: left} li a {display: block; width: 100px; height: 100px; text-decoration: none; background: transparent url ( http://www.jb51.net/upload/20072795511179.jpg ) No-repeat 500px;} a # item1: hover {background-position: 0 0;} a # item2: hover {background-position:-100px 0 ;} a # item3: hover {background-position:-200px 0;} a # item4: hover {background-position: 0-100px;} a # item5: hover {background-position: -100px-100px;} a # item6: hover {background-position:-200px-100px;} a # item7: hover {background-position: 0-200px ;} a # item8: hover {background-position:-100px-200px;} a # item9: hover {background-position:-200px-200px ;} </style> <ul> <li> </ li> </ul>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]


Let's first look at the code











Is it very simple, and the image we use is only the two below

Now let's analyze the usage of background-position: at the beginning of Element A, the background position is set to background-position: 500px 500px, and its size is only 100px * 100px, therefore, all backgrounds under tag A are beyond the visible range and cannot be displayed. The black and white pictures we saw at the beginning are UL's background images. Then, when you move the mouse over element A, you can set the background movement size for each element A based on the position of each element A. This forms the alternate effect of the above black and white images.

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.