制作首页的显示列表

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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

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

@app.route('/')
def index():
    context={
        'user':'mis'
    }
    return  render_template('index.html',**context)
{% extends 'base.html' %}
  {% block title %}首页{% endblock %}
  <meta charset="UTF-8">
   
  {% block main %}
      <img src="{{ url_for('static',filename='images/86x97sZ11K4.jpg') }}" alt="qa">
   
      <p>{{ username }}contextx</p>
      <ul class="list-group" style="align-content: center">
  
             <li class="list-group-item">
                 <span class="glyphicon glyphicon-leaf" aria-hidden="true"></span>
                 <a href="#">user</a>
                 <br>
                 <a href="#">标题</a>
                 <span class="badge">发布时间</span>
            <p style="text-indent: 18px">内容</p>
            </li>
 
     </ul>
 {% endblock %}

 

posted on 2017-12-02 22:13  081肖妍  阅读(90)  评论(0)    收藏  举报

导航