2016-11-04 63 views
-3

使用树枝时,如何向我的表格行添加交替颜色?SYMFONY 2.8 + Bootstrap, - 表中奇偶行的不同颜色

{% if pagination.getTotalItemCount > 0 %} 
     <div class="top17 panel panel-default"> 
      <table class="table table-responsive table-striped"> 
       {% for item in pagination %} 



        <tr class="tr-hover redirect" data-url="{{ url('item_details', {'id' : item.id}) }}"> 
         <td class="hidden-xs item-image"><img src="{{ asset(item.webPath) }}"/></td> 
         <td>{{ item.name }}</td> 
         <td class="hidden-xs">{{ item.topic }}</td> 
         <td>{{ item.price }} SM</td> 
         <td> 
          <a href="{{ url('buy_item', { 'id' : item.id }) }}" class="btn btn-success"> 
           <span class="glyphicon glyphicon-shopping-cart"></span> 
           <span class="hidden-xs">{{ "Buy" | trans }}</span> 
          </a> 
         </td> 
          </tr> 

       {% endfor %} 
      </table> 
     </div> 
+0

有帮助吗?如果你不能帮助,就过去吧。 – zoore

+0

@Sam Dufel - 感谢您的编辑! – zoore

回答

0

这已经在此处提出质疑。

CSS - background color of table row odd/even

希望有所帮助。

+0

而不是发布作为答案,而是将问题标记为重复。 –

+1

@CacheStaheli好的,下次再说,谢谢。 – msfontana

+0

@msfontana - 它只是CSS,我正在寻找在TWIG中做到这一点的方式 – zoore