管理后台简单示例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        body{
            /*去掉最顶部间距*/
            margin: 0;
        }
        .left{
            float: left;
        }
        .right{
            float: right;
        }

        .pg-header{
            height: 48px;
            background-color: #2459a2;
            color: white;
            /*line-height值等于div高度使文字垂直居中*/
            line-height: 48px;
        }
        .pg-header .logo{
            width: 200px;
            background-color: cadetblue;
            text-align: center;

        }
        .pg-header .user{
            /*width: 160px;*/
            height: 48px;
            /*background-color: wheat;*/
            position: relative;
            color: white;
            margin-right: 60px;
            padding: 0 20px;

        }
        .pg-header .user:hover{
            background-color: blue;
        }
        .pg-header .user .a img{
            height: 40px;
            width: 40px;
            margin-top: 4px;
            margin-left: 4px;
            border-radius: 50%
        }
        .pg-header .user .b{
            position: absolute;
            top: 48px;
            right: 44px;
            background-color: white;
            z-index: 20;
            width: 160px;
            /*b默认不显示*/
            display: none;
        }

        /*当鼠标放在user上的时候b就显示出来*/
        .pg-header .user:hover .b{
            display: block;
        }
        .pg-header .user .b a{
            display: block;
            color: black;
            /*去掉a标签的下划线*/
            text-decoration: none;
        }

        /*左侧菜单跟随滚动条*/
        .pg-content .menu{
            /*absolute定位会随着滚动条滑动而滑动,fixed不会随滚动条滑动而滑动,relative单独使用没用*/
            position: absolute;
            top:48px;
            left: 0;
            bottom: 0;
            width: 200px;
            background-color: #dddddd;

        }
        .pg-content .content{
            /*使用absolute,当内容较多时,一屏之后的数据就没有背景色,可将该内容用一个div包裹起来加背景色解决*/
            position: absolute;
            top: 48px;
            right: 0;
            bottom: 0;
            left: 200px;
            /*当屏幕缩小到最小宽度后会出现滚动条滑动查看横向内容*/
            min-width: 500px;
            /*background-color: purple;*/
            /*加了overflow: auto;后当内容太多时会出现滚动条,当 position: absolute;时加了overflow: auto;左侧菜单及header
            不跟随滚动条滚动,不加就跟随滚动条滚动*/
            overflow: auto;
            z-index: 9;
        }

    </style>
</head>
<body>

<div class="pg-header">
    <div class="logo left">
        hello
    </div>
    <div class="user right">
        <a class="a" href="#">
            <img src="可领取右下角.png">
        </a>
        <div class="b">
            <a href="#">我的资料</a>
            <a href="#">注销</a>
        </div>
    </div>
</div>

<div class="pg-content">
    <div class="menu left">q</div>
    <div class="content left">
        <div style="background-color:purple;">
        <p style="margin: 0">hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>

        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        <p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p><p>hhh</p>
        </div>
    </div>
</div>

<div class="pg-footer"></div>

</body>
</html>
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容