I think this is a different question from other "autofit"-related questions.
I have single-line text label that I'd like to auto-fit to always be half the screen width (dynamically during and after resize, etc.) as well as centered on the page vertically and horizontally. I've tried the jQuery FitText plugin, but it does not seem to work well with vertical centering (shifts up or down depending on the font size, sometimes below the viewport)
It may be due to my use of absolute positioning, but I can't find any alternate way to accomplish this.
My CSS:
h1 {
position: absolute;
top: 25%;
right: 25%;
left: 25%;
bottom: 25%;
display: table-cell;
vertical-align: middle;
}
This JSFiddle shows the block I would like to fill: http://jsfiddle.net/KFySS/6/
Edit: I've added a fake background image text to the fiddle above, which behaves very closely to what I'd like the real size behave to be.
I want the short text to fill the block outlined with dashed line. It should also be centered vertically and/or horizontally. This bounding box is just for illustration, but it was my starting point when using the Fittext plugin.