Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 如何在烧瓶模板中有单独的for循环(在单独的列中)?_Html_Css_For Loop_Flask - Fatal编程技术网

Html 如何在烧瓶模板中有单独的for循环(在单独的列中)?

Html 如何在烧瓶模板中有单独的for循环(在单独的列中)?,html,css,for-loop,flask,Html,Css,For Loop,Flask,我第一列中第一个for循环中的最后一个链接也是到第二列中标题的链接,在这里我有第二个for循环。在这个例子中,西兰花的链接也在文本之前的广告中创建了一个超链接,我不明白为什么 标题中不应有任何链接以前的广告。我相信这是Flask模板中的一个HTML问题,下面是我的代码 {% extends "layout.html" %} {% block main %} <form action="{{ url_for('searched') }}" meth

我第一列中第一个
for
循环中的最后一个链接也是到第二列中
标题的链接,在这里我有第二个
for
循环。在这个例子中,
西兰花
的链接也在文本
之前的广告
中创建了一个超链接,我不明白为什么

标题中不应有任何链接
以前的广告
。我相信这是Flask模板中的一个HTML问题,下面是我的代码

{% extends "layout.html" %}

{% block main %}
<form action="{{ url_for('searched') }}" method="post">
    <div class="form-group">
        <input placeholder="Search food" type ="search" name="search"/>
        <button class="btn btn-success" type="submit" name="action"><span class="glyphicon glyphicon-search"></span></button>
    </div>
</form>

<div class="row">
    <div class="column">
    <h2>Live Ads</h2>
        <dl class="desc-info" style ="text-indent: 15%">
        {% for ad in ads %}
        <a href="{{ url_for('ads', image_key = ad.image_key, posts = ad.image_key)}}">{{ad.title}}
        {% endfor %}
        </dl>
    </div>
    <div class="column">
    <h2>Previous Ads</h2>
        <dl class="desc-info" style ="text-indent: 15%">
            {% for inactive_ad in inactive_ads %}
            <dt><a href="{{ url_for('ads', image_key = inactive_ad.image_key, posts = inactive_ad.image_key)}}">{{inactive_ad.title}}</dt>
            {% endfor %}
        </dl>
    </div>
</div>
{%extends“layout.html”%}
{%block main%}
现场广告
{ads%中的广告为%s}
{{ad.title}}
{%endfor%}
以前的广告
{非活动广告%中的非活动广告%}
{{不活跃的广告标题}
{%endfor%}

所有其他链接都正常工作<代码>描述信息
仅将文本向左对齐。我在另一个页面上有几乎相同的代码,但这里唯一的区别是
for
循环位于第二列,而不是几行
href
链接。

看起来您忘记了使用
关闭锚定标记

所以在“直播广告”下(你可能也忘了这里的
标签):


在“以前的广告”下:

<dt>
  <a href="{{ url_for('ads', image_key = inactive_ad.image_key, posts = inactive_ad.image_key)}}">{{inactive_ad.title}}</a>
</dt>

<dt>
  <a href="{{ url_for('ads', image_key = inactive_ad.image_key, posts = inactive_ad.image_key)}}">{{inactive_ad.title}}</a>
</dt>