间距相等div的容器中的 [英] Equal spacing div's in a container
本文介绍了间距相等div的容器中的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是我的例子: http://jsfiddle.net/rtCP3/62/
我有3个(或更多!)div的我想的空间在一个容器一样。当使用角度与NG-重复的样式没有被拾起。当我辛苦code它工作得很好。
I have 3 (or more!) div's I want to space equally in one container. When using angular with ng-repeat the styles are not being picked up. When I hardcode the exact same elements it works just fine.
角度输出:
<div class="container ng-scope" ng-controller="ParentCtrl">
<!-- ngRepeat: item in list -->
<div class="box ng-scope ng-binding" data-ng-repeat="item in list">item1</div>
<div class="box ng-scope ng-binding" data-ng-repeat="item in list">item2</div>
<div class="box ng-scope ng-binding" data-ng-repeat="item in list">item3</div>
<div class="box ng-scope ng-binding" data-ng-repeat="item in list">item4</div>
<span class="stretch"></span>
</div>
硬codeD:
<div class="container">
<div class="box">Item 1</div>
<div class="box">Item 2</div>
<div class="box">Item 3</div>
<div class="box">Item 4</div>
<span class="stretch"></span>
</div>
根据我这这个计算器的问题:流体宽度与等距的DIV
推荐答案
这工作。我不知道为什么,但它的空间是相同的:
This works. I'm not sure why, but it spaces it the same:
<div class="container" ng-controller="ParentCtrl">
<span data-ng-repeat="item in list">
<div class="box">{{ item.name }}</div>
</span>
<span class="stretch"></span>
</div>
也许别人可以解释为什么这样的作品,但在你的提琴重复跨度元素,但与盒类中提出两种实现看起来是一样的。
Maybe someone else can explain why that works, but in your fiddle repeating on the span element but with the box class inside made both implementations look the same.
这篇关于间距相等div的容器中的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文