python-后台布局

272 阅读3分钟

layout.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{% block title %}{% endblock %}</title>
    <link rel="stylesheet" href="/static/css/commons.css">
    {% block css %}{% endblock %}
    <style>
        body{
            margin: 0;
        }
        {#a{#}
        {#    text-decoration: none;#}
        {#}#}
        .left{
            float: left;
        }
        .right{
            float: right;
        }
        .hide{
            display: none;
        }
        .pg-header{
            height: 48px;
            background-color: green;
            min-width: 1100px;
            line-height: 48px;
            font-size: 13px;
        }
        .pg-header .logo{
            color: white;
            font-size: 24px;
            width: 200px;
            background-color: black;
            text-align: center;
        }
        .pg-header .hl-menu .item,.pg-header .hr-menu .item{
            color: white;
            padding: 0 10px;
            height: 48px;
            display: inline-block;
        }
        .pg-header .hl-menu .item:hover,.pg-header .hr-menu .item:hover{
            background-color: red;
        }
        .pg-header .hl-menu .item-set{
            display: inline-block;
            position: relative;
        }
        .pg-header .hl-menu .item-set .sets{
            position: absolute;
            width: 150px;
            background-color: aliceblue;
            border: 1px solid red;
            display: none;
        }
        .pg-header .hl-menu .item-set .sets a{
            display: block;
            line-height: 30px;
        }
        .pg-header .hl-menu .item-set:hover .sets{
            display: block;
        }
        .avatar{
            display: inline-block;
            position: relative;
        }
        .avatar .sets{
            position: absolute;
            width: 150px;
            border: 1px solid greenyellow;
            left: -90px;
            top: 48px;
            display: none;
        }
        .avatar .sets a{
            display: block;
        }
        .avatar img{
            margin-top: 4px;
            border-radius: 50%;
        }
        .avatar:hover .sets{
            display: block;
        }
        .pg-body .menus{
            width: 200px;
            position: absolute;
            left: 0;
            bottom: 0;
            top: 48px;
        }
        .pg-body .contents{
            position: absolute;
            top: 48px;
            right: 0;
            bottom: 0;
            left: 205px;
            background-color: darkgreen;
            overflow: scroll;
        }
        .menus .item .item-title{
            padding: 8px;
            background-color: greenyellow;
        }
        .menus .item .item-content a{
            display: block;
            padding: 3px;
            border-left: 3px solid transparent;
        }
        .menus .item .item-content a:hover{
            border-left: 3px solid red;
        }
        .menus .item .item-content a.active{
            border-left: 3px solid red;
        }

    </style>

</head>
<body>
    <div class="pg-header">
        <div class="logo left">峰哥爱吃苹果</div>
        <div class="hl-menu left">
            <a href="#" class="item">菜单一</a>
            <a href="#" class="item">菜单二</a>
            <a href="#" class="item">菜单三</a>
            <div class="item-set">
                <a href="#" class="item">菜单四</a>
                <div class="sets">
                    <a href="#">菜单四-1</a>
                    <a href="#">菜单四-2</a>
                    <a href="#">菜单四-3</a>
                </div>
            </div>
        </div>
        <div class="hr-menu right">
            <a href="#" class="item">消息</a>
            <a href="#" class="item">通知</a>
            <a href="#" class="item">任务</a>
            <div class="avatar right">
                <a class="item" href="#">
                    <img src="/static/imgs/default.png">
                </a>
                <div class="sets">
                    <a href="#">菜单四-1</a>
                    <a href="#">菜单四-2</a>
                    <a href="#">菜单四-3</a>
                </div>
            </div>
        </div>

    </div>
    <div class="pg-body">
        <div class="menus">
            <div class="item">
                <div class="item-title">标题一</div>
                <div class="item-content hide">
                    <a href="#">文章管理</a>
                    <a id="menu_tag" href="#">标签管理</a>
                    <a href="#">分类管理</a>
                </div>
            </div>
            <div class="item">
                <div class="item-title">标题二</div>
                <div class="item-content hide">
                    <a href="#">文章管理</a>
                    <a href="#">标签管理</a>
                    <a href="#">分类管理</a>
                </div>
            </div>
            <div class="item">
                <div class="item-title">标题三</div>
                <div class="item-content hide">
                    <a href="#">文章管理</a>
                    <a href="#">标签管理</a>
                    <a href="#">分类管理</a>
                </div>
            </div>
        </div>
        <div class="contents">
            <div style="height: 2000px;"></div>
            {% block contents %}{% endblock %}
        </div>

    </div>
    <div class="pg-footer"></div>
    {% block js %}{% endblock %}
    <script src="/static/js/jquery-2.1.4.min.js"></script>
    <script>
        $(function () {
            $('#menu_tag').addClass('active');
            $('#menu_tag').parent().removeClass('hide');
        })
    </script>
</body>
</html>

index.html

{% extends 'layout.html' %}

{% block title %}后台管理{% endblock %}