Kind of a hack but: Something like this will get you close. It likely needs a little more tweeking. Basically, it clones the element and sets the clone's text to  , so it gets an idea of what the height of one line would be. Then it decreases the element's font size until it's smaller than the target height.
Keep in mind you would also need to attach this function to the parent's resize().
$(document).ready(function() {
$(".shrink").each(function() {
var targetHeight = $(this).clone().html(" ").insertAfter($(this));
while ($(this).height() > targetHeight.height()) {
$(this).css("font-size", parseInt($(this).css("font-size")) - 1);
}
targetHeight.remove();
});
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…