How to change the font size in table cells according to cells content ?
Posted
by misha-moroshko
on Stack Overflow
See other posts from Stack Overflow
or by misha-moroshko
Published on 2010-04-22T13:34:58Z
Indexed on
2010/04/22
16:53 UTC
Read the original article
Hit count: 141
I have an HTML table which has incrementing numbers starting from 0 in its cells (left to right, up to bottom).
I fixed in CSS the width
and the height
of the cells (40px width, 25px height, in my case).
When the table becomes larger, the numbers inside it becomes large also (for example, the last number is 1266356). This causes the cells to be wider than I defined in the CSS, which expands the whole table accordingly.
Instead, I would like the font of the numbers to be smaller to keep the width of the cell 40px.
How can I accomplish this using CSS / Javascript / jQuery ?
© Stack Overflow or respective owner