css sprite 調整大張圖片中小表徵圖的大小

來源:互聯網
上載者:User
直接說解決方案:

假設一張拼合好的大圖大小是:900 x 1000 px (如)

現在想取圖中左上方的河馬表徵圖,並縮小表徵圖的大小。

正常取圖:

.sprite {background: url('imgs/woqu_localjoin_all.png') no-repeat -21px -80px;width: 190px;height: 154px;}

現在取正常表徵圖大小的一半:

<pre name="code" class="html">.sprite {background: url('all.png') no-repeat -10px -40px;width: 95px;height: 74px;background-size:450px 500px;}

OK,大功告成!

最後推薦大家一款css sprite測量工具:http://www.spritecow.com/

開啟,把拼合好的png圖拖進去:

  • 相關文章

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.