Usage of alternative background-position
Related Tags:
Code:
<style>
Ul (width: 300px; height: 300px; margin: 0px auto; padding: 0px; overflow: hidden; background: transparent url (image / menu_gray.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 (image / menu_color.jpg) no-repeat 500px 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> <a Id="item1" href="#" title="Item 1"> </ a> </ li>
<li> <a Id="item2" href="#" title="Item 2"> </ a> </ li>
<li> <a Id="item3" href="#" title="Item 3"> </ a> </ li>
<li> <a Id="item4" href="#" title="Item 4"> </ a> </ li>
<li> <a Id="item5" href="#" title="Item 5"> </ a> </ li>
<li> <a Id="item6" href="#" title="Item 6"> </ a> </ li>
<li> <a Id="item7" href="#" title="Item 7"> </ a> </ li>
<li> <a Id="item8" href="#" title="Item 8"> </ a> </ li>
<li> <a Id="item9" href="#" title="Item 9"> </ a> </ li>
</ Ul>
Is not very simple, and we also used the picture is only just below the two:


Now we are to analyze the use of background-position:
A elements at the beginning of a Background Position set to background-position: 500px 500px, and the size of it that only 100 px * 100px it, so A labelling of all backgrounds can not be more than a visual scope, we begin to see the black-and-white UL photos is the background image. Then when the mouse moved to the elements on the A, A further Element in each location where they were set to the background of mobile size, thus forming the above effect of alternating black and white picture.
- Interpretation of a section of the cursor position in the insert characters js code
- HTML Tutorial - Position Control
- CSS memorandum (Float, Position, Div, inline)
- DIV
- CSS website and the relative position of absolute positioning
- CSS2.0 position attribute
- Position: absolute, absolute positioning is relative positioning of the strange phenomenon
- CSS logo effect of the current page position Principle
- CSS page layout feature Position Is Everything
- How to correctly position the use of attributes What is the role of it?
- Personal websites on the position of your interest still rely on operators
- DIV eternal middle position
- Position: relative absolute unable to break through
- Div ? ? ? ¨°
- CSS case of the use of elements POSITION
- Javascript set DIV position
- Usage of alternative background-position
- CSS position: fixed for IE
- Position: absolute absolute positioning of the strange disappearance
- Javascript TextArea how to be in the position of the cursor




