use CSS sprites for list (
  • ) background image
  • 前端 未结 7 1211
    春和景丽
    春和景丽 2020-12-30 19:51

    Is it possible to use CSS sprites for the list background image? Normally, I render my sprites with CSS like this:

    .sprite { background: url(sprite.png) no-r         
    
    
            
    相关标签:
    7条回答
    • 2020-12-30 20:31

      You can also use

      li:before {
          background:url(..) no-repeat -##px -##px;
          width:##px;
          height:##px;
          display:block;
          position:absolute;
          content: " ";
          top:##px;
          left:##px;
      }
      

      and thus get an additional element added to the DOM and give that the background image.

      0 讨论(0)
    提交回复
    热议问题