I'm looking for a solution that will automatically re-size some text in a fixed width div to fit.
The only tricky thing is that on some of them, I need the both of the font sizes to match the smallest size (to ensure that both of the elements are always the same size.) I was thinking this could be achieved by giving them the same class name or something to indicate correlation.
Thanks!
So, given a bunch of inputs and outputs:
Use this function to bind the outputs to the inputs:
Usage:
Live demo: http://jsfiddle.net/HF4W4/18/
So, the
sync
function expects an array of<input>
elements as the first argument and an array of block elements as the second argument. Notice that the output elements should havewhite-space: nowrap
set. Thesync
function inner-wraps the output elements in<span>
elements, so that it can read the width of the content.