html - 必须同时使用 max-wdith 和 min-width 而不是仅使用宽度
问题描述
我有一个 html 表格,我需要将单元格设置为特定大小。出于某种原因,我可以实现这一点的唯一方法是将 max-width 和 min-width 设置为相同的值,而不仅仅是宽度。
每个单元格的大小都需要不同,因此我需要在每个单元格上单独设置它。
.corrTable table {
border-collapse: collapse;
white-space: nowrap;
}
.corrTable td {
white-space: nowrap;
overflow: hidden;
padding: 5px;
}
.corrTable th {
padding: 5px;
}
.corrTable>tbody>tr:nth-of-type(odd) {
border: solid thin;
/*background-color: #f9f9f9;*/
}
<table class="corrTable" style="min-width:1615px">
<tr>
<td id="@i" style="max-width:75px;min-width:75px">@Model.log</td> <!--works-->
<td id="@i" style="width:75px">@Model.log</td> <!-- does not work -->
<td id="@i" width="75px">@Model.log</td> <!-- does not work-->
</tr>
</table>
任何想法?
解决方案
推荐阅读
- apache-spark - Spark 和 Yarn 的资源分配
- c# - 没有这样的表 - 内存中带有 Sqlite 的 EF Core
- amazon-web-services - 在 Redshift 中将数据加载到具有复合主键的表中
- sql-server - 如何判断我的SqlServer版本+Edition是否支持分区
- spring-boot - 使用 SimpleJdbcInsert 插入没有 bean 的表中。
- android - 使用循环依赖布局图像
- php - 将base64字符串编码为从mysql接收的swift中的图像
- ios - 单元测试:模拟用户有特定的日历
- java - 为什么intellij打包的WAR文件一般会排除resources目录
- jenkins - 在 Jenkins 中使用 rerunner-jupiter 扩展时,“junit-jupiter”未能发现测试