简体   繁体   English

如何在html css中将单个表格的某些单元格设置为固定宽度,而将某些单元格设置为可变宽度?

[英]How to set some cells as fixed width and some cells variable width of a single table in html css?

In my html I've used 在我的HTML中,我已经使用

table{
    table-layout:fixed;
}

its fixing the entire table cells. 它固定了整个表格单元格。 but I need some cells are fixed and some need to be variable? 但是我需要一些单元格是固定的,而有些需要是可变的? How to do that? 怎么做? I'm a beginner please do help 我是新手,请帮忙

If you set the table layout to fixed, you should still be able to explicitly set the width on specific <td> and <th> cells. 如果将表格布局设置为固定,则仍应能够显式设置特定<td><th>单元格的宽度。

Here's an example Fiddle 这是一个小提琴的例子

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM