简体   繁体   中英

dynamically change font size to accommodate content amount

Lets say I have a box which is 200px X 200px in size. And I have a RSS feed item within it.

My font size is set by CSS at 17px with a text shadow with a font weight of bold.

Is there a way to dynamically change the size of the font so that the whole blog title can be displayed in the 200x200 box?

PS: I am using asp:repeater control to create the html markup. So potentially i might be able to write some C#

you could do something crazy like that:

while ($('div').scrollTop() == 0) {
    $('div').css({'font-size': '+=1'}).scrollTop(100);
}
$('div').css({'font-size': '-=1'});​

:)

demo
http://jsfiddle.net/ZprxD/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM