How should I center a group of elements around the middle block?

The Catch : My solution should a) only use CSS, b) not depend on media queries, and c) work for any combination of elements at different sizes.

To test, drag the edges of each colored block in the demo below to resize them:

3 Items

230×50
290×50
140×50

4 Items

230×50
290×50
140×50
140×50

5 Items

230×50
230×50
290×50
140×50
140×50

References