雪碧圖實現登錄頁面

這是素材:html

這是代碼:服務器

<!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>Document</title>
    <style>
    .logn{
        height: 260px;
        width: 230px;
        margin: 0 auto;
        border: 1px solid black;
        background-color: rgb(200, 223, 230);
    }
    .box1{
        height: 35px;
        width: 190px;
        margin: 10px;
    }
    .chose{
        font-size: 12px;
        color: gray;
        display: inline-block;
        height: 13px;
        line-height: 13px;
    }
    .tips{
        float: right;
        color: blue;
        font-size:12px;
    }
    button{
        background-image: url("index.jpg");
        height: 35px;
        width: 190px;
        margin: 10px;
    }
    .lognin{
        background-position: 0 -3px;
    }
    .lognon{
        background-position: 0 -40px;
    }
    hr{
        color: gray;
        margin: 0;
    }
    </style>
</head>
<body>
    <div class="logn">
        <form>
        <input class="box1" type="text" placeholder="郵箱/手機號/用戶名"/>
        <br/>
        <input class="box1" type="password" placeholder="請輸入密碼"/>
        <br/>
        <input type="checkbox">
        <span class="chose">下次自動登錄</span>        
        <span class="tips">忘記密碼</span>
        <br/>
        <button class="lognin"></button>
        <hr/>
        <button class="lognon"></button>
    </form>
    </div>
    
</body>
</html>

這是效果:ui

總結一下: 雪碧圖就是把網頁要用的小圖放在一塊兒,須要的時候直接選取所在的位置,減小服務器請求次數。url

相關文章
相關標籤/搜索