首页 > 其他 > 详细

制作首页的显示列表。

时间:2017-11-30 16:48:54      阅读:832      评论:0      收藏:0      [点我收藏+]

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

无序列表

<ul >

  <li>Coffee</li>

  <li>Tea</li>

  <li>Milk</li>

</ul>

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

1:

<ul>
        <li class="post_item_summary ">
            <a class="titlelnk" target="_self" href="https://www.zhihu.com/question/47951994">怎样撸猫才能让猫舒服?</a><br>
            <a href="#" class="lightblue">{{ user }}</a>
            <br>
            <img width="48" height="48" class="pfs" src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=4066191998,32277144&fm=27&gp=0.jpg" alt="">
            <p class="post_item_summary " >
               小猫会从猫妈妈舔身体的动作上而感到安心,一般都是比较温柔的,所以,主人用手来轻轻抚摸小猫,对于它们来说也能感到安心,它会睡倒在你的怀里。
                这也是和喵培养感情的重要方法之一。其实抚摸猫的身体也有一个好处,就是可以提早发现猫咪身体上的异常。
            </p>
            <span class="post_item_foot">
            发布于   <script>document.write(Date())</script>
            </span>
            <span class="article_view"><a href="" class="gray">阅读(8)</a></span>
        </li>
    </ul>

2:

@app.route(/)
def index():
    context ={
        user:你最爱的喵咪
    }
    return render_template(index.html,**context)

技术分享图片

制作首页的显示列表。

原文:http://www.cnblogs.com/JUNJUNER/p/7920991.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!