下面是我要用到的一个背景图:
代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312"> <head> <style type="text/css" > <!-- .style1,.style2,.style3{ float:left; width:162px; height:162px; background:#CCCCCC url(/jiaocheng/UploadFiles/200804/2008041122582457.gif) 0 0 no-repeat; border:1px dotted #999999; color:red; margin-right:10px; } .style2{ background-position:-50px -50px; } .style3{ background-position:100px 100px; } .blue{ color:blue; } --> </style> </head> <body> <div class="style1"> x:0,<span class="blue">y:0</span> </div> <div class="style2"> x:-50px,<span class="blue">y:-50px</span> </div> <div class="style3"> x:100px,<span class="blue">y:100px</span> </div> </body> </body> </html>