css sprite
Commonly known as: sprite, sprite drawing, the entire page refers to different pictures or icons are combined on a map;
advantages: use CSS Sprite can reduce network requests, improve page load performance, does not appear below the upper end of the page is loaded still loaded in this issue
Cons: If you change one of the late icon, and the pixel size changes, the need to re-locate all icons
Sprite production:
photoshop transparent layer selected, will take into icons and pictures
Test chart:
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title></title> 6 <style type="text/css"> 7 #box{ 8 margin: 50px;; 9 } 10 11 #box a{ 12 display: block; 13 width: 74px; 14 height: 20px; 15 border: 1px solid #ccc; 16 color: black; 17 font-size: 12px; 18 text-decoration: none; 19 text-align: center; 20 border-top: none; 21 padding-top: 54px; 22 background-image: url(icon.png); 23 } 24 #box #zone{ 25 border-top:1px solid #CCCCCC; 26 background-position: -17px 4px; 27 background-repeat: no-repeat; 28 } 29 #box #zone:hover{ 30 background-position: -17px -98px; 31 } 32 #box #mail{ 33 background-position: -12px -186px; 34 background-repeat: no-repeat; 35 } 36 #box #mail:hover{ 37 background-position: -12px -286px; 38 } 39 </style> 40 </head> 41 <body> 42 <div id="box"> 43 <a href="#" id="zone">空间</a> 44 <a href="#" id="mail">邮箱</a> 45 </div> 46 47 </body> 48 </html>