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>