Home >Web Front-end >HTML Tutorial >Production of css sprite image_html/css_WEB-ITnose

Production of css sprite image_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:42:511008browse

Many websites actually use sprite images, which is really convenient for production. I used to think that these small icons were just pictures one by one (laughing)

The rendering is as follows:

The code is as follows:

<html><head lang="en">    <meta charset="UTF-8">    <title></title>    <style>        h3,ul {margin: 0;padding: 0;}        ul{list-style: none;}        li h3{font-size: 14px;font-weight:400;font-family:"微软雅黑" }        li{            display: block;            height: 31px;            line-height: 31px;            overflow: hidden;            border-bottom: 1px solid #dedede;            margin: 1px 10px 0        }        li i{            display:inline;            background: url(sidebar.png);            width:30px;            height: 24px;            float: left;            margin:3px 10px 0 0 ;        }        .cat{            width: 150px;            background:#f8f8f8 ;            border: 1px solid #bbb;        }        .cat-1 i  {background-position: 0 0:}        .cat-2 i{background-position: 0 -24px;}        .cat-3 i{background-position: 0 -48px;}        .cat-4 i{background-position: 0 -72px;}        .cat-5 i{background-position: 0 -96px;}        .cat-6 i{background-position: 0 -120px;}        .cat-7 i{background-position: 0 -144px;}        .cat-8 i{background-position: 0 -168px;}    </style></head><body><div class="cat">    <ul>        <li class="cat-1">            <i></i>            <h3>服装内衣</h3>        </li>    </ul>    <ul>        <li class="cat-2">            <i></i>            <h3>鞋包配饰</h3>        </li>    </ul>    <ul>        <li class="cat-3">            <i></i>            <h3>运动户外</h3>        </li>    </ul>    <ul>        <li class="cat-4">            <i></i>            <h3>珠宝手表</h3>        </li>    </ul>    <ul>        <li class="cat-5">            <i></i>            <h3>手机数码</h3>        </li>    </ul>    <ul>        <li class="cat-6">            <i></i>            <h3>护肤彩妆</h3>        </li>    </ul>    <ul>        <li class="cat-7">            <i></i>            <h3>办公电脑</h3>        </li>    </ul>    <ul>        <li class="cat-8">            <i></i>            <h3>母婴用品</h3>        </li>    </ul></div></body>

The sprite picture was put together by myself

As a non- Computer major student, I have been learning front-end for a month, I hope I can stick to it

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn