个人中心标签页导航

    1. 新页面userbase.html,用<ul ><li role="presentation"> 实现标签页导航。
      <ul class="nav nav-tabs">
        <li role="presentation"><a href="#">Home</a></li>
        <li role="presentation"><a href="#">Profile</a></li>
        <li role="presentation"><a href="#">Messages</a></li>
      </ul>

    2. 让userbase.html继承base.html。
      重写title,head,main块.
      将上述<ul>的样式放在head块,<ul>放在main块中.
      定义新的块user。

    3. 让上次作业完成的个人中心页面,继承userbase.html,原个人中心就自动有了标签页导航。

    4. 制作个人中心的三个子页面,重写userbase.html中定义的user块,分别用于显示问答、评论、个人信息。

    5. 思考 如何实现点标签页导航到达不同的个人中心子页面。
{# 新页面user.html,用<ul ><li role="presentation"> 实现标签页导航。#}

{% extends 'base.html' %}
{% block title %}个人中心{% endblock %}

{% block head %}
    {#    <style>#}
    {#        .nav1 li{#}
    {#            list-style: none;#}
    {#            float: left;#}
    {#            margin: 10px;#}
    {#        }#}
    {#    </style>#}
    <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/userbase.css') }}">
{% endblock %}

{% block main %}
    <div class="nav1">
        <ul>
            <li role="presentation"><a href="#">全部问答</a></li>
            <li role="presentation"><a href="#">全部评论</a></li>
            <li role="presentation"><a href="#">个人资料</a></li>
        </ul>
    </div>
    {% block user %}{% endblock %}
{% endblock %}

 

{% extends 'userbase.html' %}

{% block user %}
    {% block head %}
        <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/userbase.css') }}">
        <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/user.css') }}">
    {% endblock %}
    <div class="juli">
        <h3>{{ username }}<br>
            <small>全部问答</small>
        </h3>
    </div>
    <div class="xiao_ul">
        <ul>
            {% for foo in questions %}
                <li>
                    <img id="tubiao" src="{{ url_for('static',filename='images/pl.jpg') }}">
                    <a href="#">{{ foo.author.Username }}</a>
                    <a class="creat_time">{{ foo.creat_time }}</a><br>
                    {#                <p class="title" href="#" onclick="window.location.replace({{ url_for('detail')}})">{{ foo.title }}</p>#}
                    <a class="title" href="#">{{ foo.title }}</a>
                    <div class="abstract">{{ foo.detail }}</div>
                </li>
            {% endfor %}</ul>
    </div>

{% endblock %}

 

 

 

posted @ 2017-12-16 18:27  爱学习的土豆  阅读(114)  评论(0编辑  收藏  举报