【发布时间】:2014-12-18 02:05:15
【问题描述】:
我正在使用 AngularJS 将 divs 添加到一个部分,并且我希望 div 具有静态起始宽度并在我添加更多 divs,我该怎么做?
此代码不起作用:
<body ng-app="plunker" ng-controller="MainCtrl">
<section>
<div ng-repeat="div in divs track by $index">
<div class="square"></div>
</div>
</section>
<button ng-click="add()">add</button>
</body>
section {
border: 1px solid red;
overflow: hidden;
padding: 10px 0;
width: 400px;
}
.square {
width: 100px;
height: 100px;
background: #000;
margin-right: 10px;
float: left;
margin-top: 1em;
}
Plunker 链接:
【问题讨论】:
-
css 还不够吗?最小宽度 + 宽度 + 显示:块
-
你在 plunker 中看到它不是
标签: javascript jquery html css angularjs