我想覆盖为所有表定义的以下CSS样式:
table {
font-size: 12px;
width: 100%;
min-width: 400px;
display:inline-table;
}
我有一个名为'other'
的特定表。
最后,表格的装饰应该是这样的:
table.other {
font-size: 12px;
}
所以我需要删除3个属性:width
、min-width
和display
我尝试用none
或auto
重置,但没有帮助,我指的是这些情况:
table.other {
width: auto;
min-width: auto;
display:auto;
}
table.other {
width: none;
min-width: none;
display:none;
}
发布于 2011-02-23 21:16:28
"none“并不会像你想象的那样工作。为了“清除”CSS属性,必须将其设置回由CSS标准定义的默认值。因此,您应该在您喜欢的引用中查找默认值。
table.other {
width: auto;
min-width: 0;
display:table;
}
发布于 2013-12-20 18:07:38
Set min-width: inherit /* Reset the min-width */
尝尝这个。看起来不错。
发布于 2011-02-23 21:26:12
表的默认display
属性是display:table;
。另一个有用的值是inline-table
。对于表元素,所有其他display
值都无效。
没有auto
选项可以将其重置为默认值,尽管如果您使用的是Javascript,您可以将其设置为空字符串,这将会起到作用。
width:auto;
是有效的,但不是默认值。表格的默认宽度是100%
,而width:auto;
将使元素只占用所需的宽度。
不允许使用min-width:auto;
。如果设置了min-width
,则它必须有一个值,但将其设置为零可能与将其重置为默认值一样好。
https://stackoverflow.com/questions/5091357
复制相似问题