点击查看html编辑器说明文档

第二十五天edit icon

|
|
Fork(复制)
|
|
作者:
lynn-ssk
提交反馈
嵌入
设置
下载
HTML
格式化
支持Emmet,输入 p 后按 Tab键试试吧!
<head> ...
展开
</head>
<body>
            
            <!DOCTYPE html>
<html lang="pt-br">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
    <title>Dia 25</title>
</head>
<body>
    <ul>
        <li>
            <label>
                <input type="checkbox" name="">
                <div class="icon"><i class="fa fa-gamepad" aria-hidden="true"></i></div>
            </label>
        </li>
        
        <li>
            <label>
                <input type="checkbox" name="">
                <div class="icon"><i class="fa fa-glass" aria-hidden="true"></i>
                </div>
            </label>
        </li>
        
        <li>
            <label>
                <input type="checkbox" name="">
                <div class="icon"><i class="fa fa-globe" aria-hidden="true"></i>
                </div>
            </label>
        </li>
        
        <li>
            <label>
                <input type="checkbox" name="">
                <div class="icon"><i class="fa fa-gift" aria-hidden="true"></i>
                </div>
            </label>
        </li>
        
        <li>
            <label>
                <input type="checkbox" name="">
                <div class="icon"><i class="fa fa-heart" aria-hidden="true"></i>
                </div>
            </label>
        </li>
    </ul>
</body>
</html>
        
</body>
CSS
格式化
            
            * 
{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body
{
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #18191f;
}
ul 
{
    position: relative;
    display: flex;
}
ul li 
{
    list-style: none;
}
ul li label
{
    position: relative;
}
ul li label input[type="checkbox"]
{
    position: absolute;
    opacity: 0;
    cursor: pointer;
}
ul li label .icon 
{
    position: relative;
    width: 60px;
    height: 60px;
    background: #18191f;
    color: #555;
    font-size: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin: 0 10px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: -1px -1px 4px rgba(255,255,255,0.05)
                4px 4px 6px rgba(0,0,0,0.02)
                inset -1px -1px 4px rgba(255,255,255,0.05)
                inset 1px 1px 1px rgba(0,0,0,0.01);
}
ul li label .icon:before
{
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(100% - 5 px);
    height: calc(50% - 2px);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    background: rgba(255,255,255,0.05);
}
ul li label input[type="checkbox"]:checked ~ .icon
{
    box-shadow: inset 0px 0px 2px rgba(255,255,255,0.05)
                inset 4px 4px 6px rgba(0,0,0,0.02);
}
ul li label input[type="checkbox"]:checked ~ .icon .fa
{
    color: #00f3ff;
    text-shadow: 0 0 15 px #00f3ff,
                 0 0 25 px #00f3ff;
    animation: animate 5s linear infinite;
}
@keyframes animate
{
    0%
    {
        filter: hue-rotate(0deg);
    }
    100%
    {
        filter: hue-rotate(360deg);
    }
}
        
JS
格式化
            
            
        
预览
控制台