Transition Table Cell Width When Text Is Added

纵然是瞬间 提交于 2019-12-24 02:38:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!