精灵图的使用方法

Posted dzzzz

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了精灵图的使用方法相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        div {
            width: 25px;
            height: 25px;
            background: url("images/taobao.png");
            background-position: 0px 0px;
        }
        div:hover {
            background-position: 0px -89px;
        }

        /*如果使用精灵图:坐标:只有0或者负数*/
    </style>
</head>
<body>
    <div></div>
</body>
</html>

 

以上是关于精灵图的使用方法的主要内容,如果未能解决你的问题,请参考以下文章