css:如何在选择并单击后更改 table 的行颜色
css: How to change row color of a table after its been selected and clicked away
i有。css选择行时,这很好。
但是,当我单击关闭该行时,它会将行颜色更改为灰色和黑色字体,有什么方法可以编辑此 css?
.table-view {
-fx-base: transparent;
-fx-control-inner-background: transparent;
-fx-background-color: #507CA6;
-fx-padding: 5;
}
.table-view .column-header-background {
-fx-background-color: transparent;
}
.table-view .column-header, .table-view .filler {
-fx-size: 35;
-fx-border-width: 0 0 1 0;
-fx-background-color: transparent;
-fx-border-color: #B4D9FD;
-fx-border-insets: 0 10 1 0;
}
.table-view .column-header .label {
-fx-font-size: 14pt;
-fx-font-family: "Segoe UI Light";
-fx-text-fill: white;
-fx-alignment: center-left;
-fx-opacity: 1;
}
.table-view:focused .table-row-cell:filled:focused:selected {
-fx-background-color: #273D51;
}
如有任何帮助,我们将不胜感激。
试试这个:
/* When control is selected but not focused */
.table-row-cell:filled:selected,
.table-row-cell:filled > .table-cell:selected {
-fx-background: red;
}
首先选择 class 然后使用这个脚本,我总是使用这个 $("tr").click(function(){
$(this).addClass("selected").siblings().removeClass("selected");
});
i有。css选择行时,这很好。
但是,当我单击关闭该行时,它会将行颜色更改为灰色和黑色字体,有什么方法可以编辑此 css?
.table-view {
-fx-base: transparent;
-fx-control-inner-background: transparent;
-fx-background-color: #507CA6;
-fx-padding: 5;
}
.table-view .column-header-background {
-fx-background-color: transparent;
}
.table-view .column-header, .table-view .filler {
-fx-size: 35;
-fx-border-width: 0 0 1 0;
-fx-background-color: transparent;
-fx-border-color: #B4D9FD;
-fx-border-insets: 0 10 1 0;
}
.table-view .column-header .label {
-fx-font-size: 14pt;
-fx-font-family: "Segoe UI Light";
-fx-text-fill: white;
-fx-alignment: center-left;
-fx-opacity: 1;
}
.table-view:focused .table-row-cell:filled:focused:selected {
-fx-background-color: #273D51;
}
如有任何帮助,我们将不胜感激。
试试这个:
/* When control is selected but not focused */
.table-row-cell:filled:selected,
.table-row-cell:filled > .table-cell:selected {
-fx-background: red;
}
首先选择 class 然后使用这个脚本,我总是使用这个 $("tr").click(function(){ $(this).addClass("selected").siblings().removeClass("selected"); });