我有几个 HTML 表格。这些表没有 CSS 类。这两个表都有width="100%"
属性。其他表没有该width
属性。
仅使用 CSS 我需要设置没有width=100%
. 像这样的东西:
table:not(width="100%"){
width: myValue;
}
我有几个 HTML 表格。这些表没有 CSS 类。这两个表都有width="100%"
属性。其他表没有该width
属性。
仅使用 CSS 我需要设置没有width=100%
. 像这样的东西:
table:not(width="100%"){
width: myValue;
}
属性选择器由 包围[]
,因此您的选择器应如下所示:
table:not([width="100%"]) {
width: myValue;
}
在该表上使用一个类并将其放在 not
table:not(.foo) {
}
你需要一个在 not 和 width = 100% is not one 中的选择器
如何为您想要不同宽度的表格使用内联样式?
<table style="width:95%">
<tr>
<td></td>
</tr>
</table>
或者一个单独的类:
<table class="customWidth">
<tr>
<td></td>
</tr>
</table>
CSS:
table { width:100%; }
table.customWidth { width:95%; }
只写在css文件夹中table { width: 100% };