制作首页的显示列表。

1. 在首页添加显示问答的列表,并定义好相应的样式。

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

2. 用字典向index.html传递参数。

{% extends 'base.html' %}
{% block title %}
首页
{% endblock %}
{% block head %}
   <link rel="stylesheet" type="text/css" href="{{ url_for('static',filename='css/index.css') }}">

{% endblock %}

{% block main %}

   <body>

<br>

<ul class="comment">
    <img src="../static/image/tx1.png">
    <p class="wenzi">Question</p>
    <li class="detail">
        <span class="icon" aria-hidden="true"></span>
        <a href="#">username</a>
        <br>
        <a href="#">title</a>
        <span class="badge">creat_time</span>
        <p >detail{{ question }}</p>
    </li></ul>

</body>
@app.route('/')
def index():
    context={
        'question':'j123456'
    }
    return render_template('shouye.html',**context)

 

posted on 2017-12-02 00:20  020吴惠琳  阅读(166)  评论(0)    收藏  举报