间距相等div的容器中的间距、容器、div

由网友(悠闲日子)分享简介:下面是我的例子: http://jsfiddle.net/rtCP3/62/ 我有3个(或更多!)div的我想的空间在一个容器一样。当使用角度与NG-重复的样式没有被拾起。当我辛苦code它工作得很好。I have 3 (or more!) div's I want to space equally in one...

下面是我的例子: 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.

阅读全文

相关推荐

最新文章