【问题标题】:How can I divide a list in 2 parts?如何将列表分成两部分?
【发布时间】:2018-04-23 18:09:28
【问题描述】:

我有一个包含 12 个项目的列表,但我想将此列表并排分成 2 个 div 中的 6 个项目,我不知道如何,有人可以帮助我吗?

<td class="col-md-2 text-uppercase">
  <div class="collapse" id="divRows-@item.BandeiraAdministradoraId">
  @foreach (var taxa in item.TaxaBandeiraAdministradoras)
  {
      <div style="padding-left: 100px;">                 
        @Html.DisplayFor(modelItem => taxa.NumeroTaxas, new {@class = "text-uppercase"})
        @Html.Raw("X =")                                 
        @Html.DisplayFor(modelItem => taxa.ValorTaxa, new {@class = "text-uppercase"})
        @Html.Raw("%")
        <br/>
      </div>
  }
  </div>
</td>

This is the list

【问题讨论】:

  • 为什么表格单元格中有一个 div?而是查看列:developer.mozilla.org/en-US/docs/Web/CSS/CSS_Columns/…
  • 不行='(
  • 这不是一个有用的说法。什么不起作用?你到底尝试了什么?
  • 对不起,我试图把你发给我的例子的css的类放在我的div的style标签里,但是不行
  • 请使用sn-p编辑器&lt;&gt;创建一个minimal reproducible example,使用呈现的html示例而不是模板代码

标签: c# html asp.net-mvc view


【解决方案1】:

像这样:

.col {
  -moz-column-count: 2;
  -webkit-column-count: 2;
  column-count: 2;
}
  <div class="collapse col" id="divRows-1">
      <div style="padding-left: 100px;">
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      </div>
      <div style="padding-left: 100px;">
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      </div>
      <div style="padding-left: 100px;">
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      </div>
      <div style="padding-left: 100px;">
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      </div>
      <div style="padding-left: 100px;">
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      </div>
      <div style="padding-left: 100px;">
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      taxas
      </div>
  </div>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-17
    • 2020-04-05
    • 1970-01-01
    • 2021-01-07
    • 1970-01-01
    • 2019-11-05
    • 1970-01-01
    • 2019-04-27
    相关资源
    最近更新 更多