问题
I have a table cell with some text in it.
<td>Text in here</td>
I can't set the width with CSS because I don't know how much data is in other cells in the same column. However, I'd like to animate the width property in CSS when my Javascript inserts new code into the table. In other words, when the cell becomes this:
<td>More Text in here</td>
I'd like the width to smoothly transition, preferably with CSS. Since I can't set the width manually, this doesn't seem to work
td{
transition: width 0.5s ease;
}
Is there an easy workaround to this? Or do I have to resort to Javascript?
来源:https://stackoverflow.com/questions/26653172/transition-table-cell-width-when-text-is-added