Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张表格,其中单元格高度设置为不同的固定值。现在我希望这张表在某些动作上进行缩放,以便单元格宽度保持不变,但高度将按相同的因子缩放。
当然,我可以使用 JavaScript 循环遍历所有单元格并为它们设置高度,但我希望能发现一些只能缩放高度的单一幻数。
这种可能性存在吗?
用 jQuery 制作很简单
$('td').each(function(){ $(this).css({height:$(this).height(),width:'auto'}); });
或者您只需要在需要时在您的 CSS 中设置 width:auto