My goal is to create a dynamic N-by-2 grid that adjusts its display based on run-time factors, resulting in an unknown number of rows and columns at design time. The grid could have different configurations like:
1 2
3 4
5
or
1 2
4 5 (missing 3)
or
1 3 (missing 2, 5)
4 (last column)
The challenge is to ensure that the last element is always centered within the grid. Each div
is set as .col-xs-6
to establish the grid as N-by-2.
How can I guarantee that the last column will be centered without knowing which one it is beforehand during the design phase? Since the position of the last column is uncertain, using offsets for specific columns is not feasible. Any suggestions are welcome!
Check out this link for reference.
If CSS or Bootstrap alone cannot accomplish this, please advise me accordingly.