【问题标题】:SYMFONY 2.8 + Bootstrap, - different colors for odd even rows in tablesSYMFONY 2.8 + Bootstrap, - 表中奇偶行的不同颜色
【发布时间】:2017-03-18 04:32:13
【问题描述】:

如何使用 twig 为表格行添加交替颜色?

 {% 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>

【问题讨论】:

  • 有什么帮助吗?如果你帮不上忙,就离开吧..
  • @Sam Dufel - 感谢您的编辑!

标签: css twig html-table


【解决方案1】:

这里之前已经有人质疑过。

CSS - background color of table row odd/even

希望对您有所帮助。

【讨论】:

  • 不要将其作为答案发布,而是将问题标记为重复。
  • @msfontana - 它只是 CSS,我正在寻找在 TWIG 中做到这一点的方法
猜你喜欢
  • 2012-08-19
  • 1970-01-01
  • 2014-03-21
  • 2014-07-20
  • 2017-05-21
  • 2018-07-04
  • 2011-06-17
  • 2021-08-26
  • 2021-01-02
相关资源
最近更新 更多