I recently needed to display a few contextual numbers near each other in a web app. I’ve taken to liking the twitter bootstrap ‘badges’ for little informational numbers, especially with the color coding that badge-important
, badge-info
, and badge-success
provide. Easy ways to quickly communicate not only the number, but a hint at what it means.
The problem is that when you put a bunch of badges right next to each other, you get kindof a mess.
So I went looking for ‘split badges’ (or some such thing), which I’ve seen on various applications, notibly on ‘Things’:
But I couldn’t find anything that just ‘told’ me how to do it, or put it in a plugin… or anything. So I set out to just make it happen.
I’m using rails and twitter bootstrap, so I threw this in bootstrap_and_overrides.css.less
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
1 2 3 4 5 |
|
Then I went to implement them and noticed the gaps.
Since I was using HAML, the spans automatically had spaces inserted around them. Hmmmm…
Apparently all it takes is a little >
to tell HAML to behave.
1 2 3 4 5 |
|
And we have what we want! Yay for clean badges!