1068
1、将页面所涉及的所有零星背景图像集中到大图中,然后将大图用于网页。用户访问页面时,只需向服务器发送一次请求。
2、直接使用background-position等属性来准确定位所需的背景部分。
实例
<!DOCTYPEhtml> <html> <head> <metacharset="UTF-8"> <title>Title</title> </head> <body> <div> <span></span> <span></span> <span></span> </div> </body> <style> .boxspan{ display:inline-block; .j{ background:url("abcd.jpg")no-repeat-389px-141px; width:102px; height:112px; .w{ background:url("abcd.jpg")no-repeat-117px-560px; width:135px; height:112px; .t{ background:url("abcd.jpg")no-repeat-368px-417px; width:102px; height:112px; </style> </html>