精灵图!

精灵图

用ps测量的像素值才对得上。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>利用精灵图拼出自己名字</title>
    <style>
        span {
            display: inline-block;
            background: url(images/abcd.jpg) no-repeat;
        }
        .c {
            width: 130px;
            height: 140px;
            /* 图片向左移 */
           background-position:  -230px 0px;
        }
        .o {
            width: 120px;
            height: 117px;
            /* 图片向左移;向上移 */
            background-position: -371px -268px;
        }
        .k {
            width: 108px;
            height: 128px;
            /* 图片向左移;向上移 */
            background-position: -493px -132px;
        }
        .i {
            width: 67px;
            height: 119px;
            /* 图片向左移;向上移 */
            background-position: -321px -130px;
        }
        .e {
            width: 118px;
            height: 123px;
            /* 图片向左移;向上移 */
            background-position: -472px 0px;
        }
    </style>
</head>
<body>
    <span class="c">c</span>
    <span class="o">o</span>
    <span class="o">o</span>
    <span class="k">k</span>
    <span class="i">i</span>
    <span class="e">e</span>
</body>
</html>

posted on 2022-02-07 11:14  cookie的笔记簿  阅读(40)  评论(0编辑  收藏  举报