---
title: "CSS-background-position"
author: "demojava"
date: "2010-12-17T13:46:48Z"
tags: []
categories: ["Web前端"]
slug: "css-background-position"
draft: false
lastmod: "2010-12-17T13:46:48Z"
id: 845523
url: "https://demojava.iteye.com/blog/845523"
---

#edit\_bar{  
 width:99%;  
 margin:5px 0px 0px 0px;  
 padding:3px 0px 0px 0px;  
 height:21px;  
 backgroud:url(../images/edit\_bar.gif) no-repeat left 0;  
 }  
#edit\_bar li,#edit\_bar li a {float:right; display:inline; width:74px; height:21px;outline:none;}  
#edit\_bar li a { width:auto; text-indent:-9999px; background:url(../images/edit\_bar.gif) no-repeat left 0; }

#edit\_bar .s01 a{ width:64px; }  
#edit\_bar .s01 a:hover{background-position:0px -21px; }

#edit\_bar .s02 a{ width:64px; background-position:-72px 0px; }  
#edit\_bar .s02 a:hover{background-position:-72px -21px;}

#edit\_bar .s03 a{ width:64px;background-position:-144px 0px;}  
#edit\_bar .s03 a:hover{background-position:-144px -21px; }

#edit\_bar .s04 a{ width:64px;background-position:-216px 0;}  
#edit\_bar .s04 a:hover{background-position:-216px -21px; }

#edit\_bar .s05 a{ width:64px;background-position:-288px 0;}  
#edit\_bar .s05 a:hover{background-position:-288px -21px; }

#edit\_bar .s06 a{ width:64px;background-position:-360px 0;}  
#edit\_bar .s06 a:hover{background-position:-360px -21px; }

一组图片，通过控制显示位置来控制显示图片的大小，而不是用到的所有图片都找得到  
而是一张图片，放所项目有的要用的图片