I have a floated div, and a user can change the font size. When they do, I have this code:
$(element).css ( 'font-size', newFontSize);
alert ( $(element).css ( 'height' ) ); //60px
$(element).css ( 'width', 'auto' );
$(element).css ( 'height', 'auto' );
alert ( $(element).height()); //60 - no resize
The idea is that by resetting the div to auto height, it should resize to fit the text, but it’s not doing so. Ideas?
maybe your code doesn’t work because you also set a
min-heightsomewhere along with the heightas alternative idea you could set the height in
em(or other relative measurements), so when you change the font-size the height will change automatically (without set its height toauto)