Html CSS:非属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14339861/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CSS :Not attribute
提问by Sanya530
I have a few HTML tables. These tables do not have CSS classes. The two tables have width="100%"
attribute. Other tables don't have the width
attribute.
我有几个 HTML 表格。这些表没有 CSS 类。这两个表都有width="100%"
属性。其他表没有该width
属性。
Using only CSS I need to set the width of the tables which don't have width=100%
. Something like this:
仅使用 CSS 我需要设置没有width=100%
. 像这样的东西:
table:not(width="100%"){
width: myValue;
}
回答by BoltClock
Attribute selectors are surrounded by []
, so your selector should look like this instead:
属性选择器被 包围[]
,因此您的选择器应如下所示:
table:not([width="100%"]) {
width: myValue;
}
回答by zzzzzzzzz
use a class on that table and put that in the not
在那个桌子上使用一个类并将其放在 not
table:not(.foo) {
}
you need a selector in the not and width = 100% is not one
你需要在 not 和 width = 100% 不是一个选择器
回答by Brian Salta
How about using inline styles for the tables you want to have different widths?
对于想要具有不同宽度的表格,如何使用内联样式?
<table style="width:95%">
<tr>
<td></td>
</tr>
</table>
OR a separate class:
或一个单独的类:
<table class="customWidth">
<tr>
<td></td>
</tr>
</table>
CSS:
CSS:
table { width:100%; }
table.customWidth { width:95%; }
回答by Zlatko Soleniq
just write in the css folder table { width: 100% };
只写在css文件夹中 table { width: 100% };