目前,对于文章中的每篇文章,都会创建一个带有 span4 类的新 div。相反,对于每一行,我想将其内容限制为三个跨度,并在达到该限制后创建一个新行。我怎样才能最好地实现这一点?
{% extends "base.html" %}
{% block content %}
<div class="container-fluid">
<legend></legend>
<div class="row-fluid" id="main">
{% for article in articles %}
<div class="span4">
<div class="thumbnail">
<a href="{{ article.url }}"><img src="http://placehold.it/300x150/483CB4"></a>
<div class="caption">
<h4><a href="{{ article.url }}">{{ article.title }}</a></h4>
<p> {{ article.summary }}</p>
</div>
<legend></legend>
<a class="btn" href="#"><i class="icon-thumbs-up"></i></a>
<a class="btn" href="#"><i class="icon-thumbs-down"></i></a>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock %}
目标:
<div class="row">
<div class="span4">article[0]</div>
<div class="span4">article[1]</div>
<div class="span4">article[2]</div>
</div>
<div class="row">
<div class="span4">article[3]</div>
<div class="span4">article[4]</div>
<div class="span4">article[5]</div>
</div>