How to equally distribute elements horizontally using CSS

后端 未结 6 924
一向
一向 2021-01-14 18:53

I have eleven dots arrange horizontally using CSS. How can I evenly/equally distribute spacing between elements (mine are elements) based on the wi

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-14 19:20

    Slight cheat...using JS

    See my JSfiddle

    var childArray = document.getElementById('bullets').children;
    
    left = 190;
    for (var i = 0; i < childArray.length; i++)
    {
        var cur_left = (i*left).toString();
        childArray[i].style.left = cur_left+"px";
    }
    

提交回复
热议问题