that's what the "paddingRight" feature is for in the helper function - it represents the number of pixels of extra space you want to put on the right side of the loop, so that it places the looping element the right distance from the end. I set box-sizing: border-box to simplify things, and computed your margin value in this fork:  See the Pen MWxjxLy?editors=0110 by GreenSock (@GreenSock) on CodePen   Is that what you're looking for?