Prevent break of pagination elements when wrapped

This rebases #5271 for 1.8. Since the LIs are inline-block, I eliminated the height and made the inner links/spans display:block in order to prevent these elements from overlapping when wrapped.

Have not tested on IE yet.