什么是css精灵图技术
1、将页面所涉及的所有零星背景图像集中到大图中,然后将大图用于网页。用户访问页面时,只需向服务器发送一次请求。
2、直接使用background-position等属性来准确定位所需的背景部分。
实例
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <div> <span></span> <span></span> <span></span> </div> </body> <style> .box span { 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>
1、使各种特殊形状的背景能够适应元素中的文本内容,并自由拉伸和滑动。2、宽度足够长的背景图,同时设置在链接和链接文本的背景上,一左一右拉伸。实例a { display: inline-block; height: ...