1

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#

Sam Hosseini
  • 813
  • 2
  • 9
  • 17
SOLDIER-OF-FORTUNE
  • 1,634
  • 5
  • 39
  • 66

1 Answers1

1

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/

Andy
  • 29,707
  • 9
  • 41
  • 58
  • Thanks Andy! or i could just force the title to be a set number of characters and add "..." on the end using jquery. – SOLDIER-OF-FORTUNE Apr 06 '12 at 14:54
  • 1
    @sp-1986 then you may want to look into the text-overflow:ellipsis css property http://www.quirksmode.org/css/textoverflow.html – Andy Apr 06 '12 at 14:55