2016-11-04 14 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