Java 如何在选择时保持奇数/偶数背景色?
我有一个GWTJava 如何在选择时保持奇数/偶数背景色?,java,gwt,datagrid,celltable,Java,Gwt,Datagrid,Celltable,我有一个GWTDataGrid(CellTable),奇偶行的背景颜色不同: .dataGridEvenRow { background: white !important; } .dataGridEvenRowCell { border: selectionBorderWidth solid white !important; } .dataGridOddRow { background: red !important; } .dataGridOddRowCell { border: sele
DataGrid
(CellTable),奇偶行的背景颜色不同:
.dataGridEvenRow { background: white !important; }
.dataGridEvenRowCell { border: selectionBorderWidth solid white !important; }
.dataGridOddRow { background: red !important; }
.dataGridOddRowCell { border: selectionBorderWidth solid red !important; }
在选择时,我只想更改边框颜色,但不应更改背景。但当我使用如下样式时,背景总是更改为“white
”
/* Here something must be wrong */
.dataGridSelectedRow {
background: inherit !important;
color: inherit !important;
}
这是细胞的内部背景。但是它不是从奇数行/偶数行继承的,而是从其他行继承的…在css中尝试以下方法:
tr:nth-of-type(odd) {
background-color:#ccc;
}
这些是css中的伪类选择器,请告诉我这是否解决了您的问题我使用以下样式修复了它:
.dataGridSelectedRow {
color: inherit !important;
}
.dataGridSelectedRowCell {
background: inherit;
border: selectionBorderWidth solid inherit !important;
}
重要的是不要使用!这里的背景属性很重要。不知道为什么,但它只能这样工作。
org.w3c.css.sac.CSSParseException:类型的第n个伪函数名无效(位于org.w3c.fleet.parser.parser.pseudo(parser.java:2038)位于org.w3c.fleet.parser.parser.simple_选择器(parser.java:1604)位于org.w3c.fleet.parser.parser.parser.selector(parser.java:1519)