发表于: 2020-06-17 22:20:48

1 1325


今天完成的事情:

完成了任务13的页面

关于隐藏侧边栏

html代码:

<div class="label">
            <div class="label-1"></div>
            <div class="label-1"></div>
            <div class="label-1"></div>
            <aside>
            <ul>
                <li>
                    <div class="head">
                        <img src="13w/小狗.png">
                    </div>
                    <span>我的</span>
                </li>
                <li>
                    <img src="13w/通知.png">
                    <span>公告</span>
                    <img class="img-right" src="13w/右箭头.png">
                </li>
                <li>
                    <img src="13w/设置.png">
                    <span>设置</span>
                    <img class="img-right" src="13w/右箭头.png">
                </li>
                <li>
                    <img src="13w/帮助.png">
                    <span>帮助</span>
                    <img class="img-right" src="13w/右箭头.png">
                </li>
                <li>
                    <img src="13w/关于.png">
                    <span>关于</span>
                    <img class="img-right" src="13w/右箭头.png">
                </li>
            </ul>
            </aside>
        </div>


css代码:

html{
    overflow: hidden; //超出部分隐藏//
}
body{
    margin0 auto;
    padding0;
    max-width480px;
    min-width320px;
    overflow: hidden; //超出部分隐藏 html和body都需要设置该属性//
    position: relative; //父级相对定位//
}
header{
    @include flex;
    width100%;
    height60px;
    background$header-background;
    .label{
        .label-1{
            width22px;
            height3px;
            background: #fbfbfb;
            margin5px 10px;
        }
    }
    aside{
        width250px;
        position: absolute; //子级绝对定位//
        top:0;
        bottom0;
        left-250px; //将导航栏拖到页面左侧//
        background: #fbfbfb;
        transition0.2s ease-out; //添加过度动画//
        font-size17px;
        color:$header-background;
        box-shadow-1px 0 5px #d9d9d9 inset;
        .head{
            @include flex;
            width40px;
            height40px;
            margin0 10px 0 20px;
            background$header-background;
            border-radius50%;
            img{
                margin0 auto;
            }
        }
        li{
            @include flex;
            height50px;
            border-bottom2px solid #f0f0f0;
            img{
                height23px;
                margin0 20px;
            }
            .img-right{
                margin-left: auto;
            }
            &:hover{
                background: #d8d8d8;
            }
        }
    }
}
ul{
    padding0;
    margin0;
    list-style: none;
}

然后用input属性设置点击触发侧边栏



返回列表 返回列表
评论

    分享到