如何将列表分成两部分?
Posted
技术标签:
【中文标题】如何将列表分成两部分?【英文标题】: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编辑器<>
创建一个minimal reproducible example,使用呈现的html示例而不是模板代码
【参考方案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>
【讨论】:
以上是关于如何将列表分成两部分?的主要内容,如果未能解决你的问题,请参考以下文章