我想做一组固定在页面底部的按钮,并用固定的空格隔开。我使用angularJS的ng-repeat指令通过ajax请求获取数据,然后使用该请求显示按钮。
我的问题在于让按钮以恒定的数量分开。
http://jsfiddle.net/8obgugd7/
正如您所看到的,其中三个按钮位于完全相同的空间中,因为边距不是累积的。有没有什么方法可以让我使用CSS来根据之前相邻的同级元素来确定元素的边距?
类似于:
.sticky-footer{
position: fixed;
bottom: 0;
margin-left: 20px;
}
.sticky-footer + .sticky-footer{
margin-left = (previous sibling's margin) + 100;
}发布于 2015-05-05 22:07:06
你做错了。做一个容器,把它放进去,然后按下里面的按钮
Demo
.sticky-footer{
position: fixed;
bottom: 0;
left: 0;
}
.sticky-footer button {
margin-left:20px;
}
<div class="sticky-footer">
<button>click me</button>
<button>click me</button>
<button>click me</button>
<button>click me</button>
</div>https://stackoverflow.com/questions/30055259
复制相似问题