Vertically center text using box-align on inline-block element
I'm trying to center text vertically in an inline-block Element (and particularly in webkit browsers). Pretty much exactly what the
I've tried using box-align, as in this question Vertical align text in block element but I don't want to set an explicit width on the element: I want it to fit to its contents, i.e. I want display: inline-block type behavior.
In Firefox, -moz-box appears to behave the way I want, but in Safari and Chrome, -webkit-box makes the div want to fill its container horizontally.
[oops, can't post image as I'm a noob]
Fiddle here with examples of various settings.
Looking at webkit's inspector on an actual
It seems that by adding an extra
So is webkit's behavior correct? How does the
This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here