【发布时间】:2013-09-24 17:08:14
【问题描述】:
我需要使用 primefaces 隐藏所有面板网格的所有边框。我试过他没有效果:
table {
border: none;
}
table tr, table td {
border: none;
}
我能做什么?
【问题讨论】:
标签: css jsf primefaces border panelgrid
我需要使用 primefaces 隐藏所有面板网格的所有边框。我试过他没有效果:
table {
border: none;
}
table tr, table td {
border: none;
}
我能做什么?
【问题讨论】:
标签: css jsf primefaces border panelgrid
您需要至少与 PrimeFaces 默认选择器一样具体。
.ui-panelgrid>*>tr,
.ui-panelgrid .ui-panelgrid-cell {
border: none;
}
除非您需要覆盖 HTML 元素上的硬编码 style,否则请勿使用 !important。
【讨论】:
!important 标志是一种解决方法,而不是解决方案。正确的解决方案是相应地更改 CSS 选择器以适应 PrimeFaces 5.1 默认 CSS 中的更改。有关详细信息,另请参阅答案中的第一个链接。
此解决方案仅影响 panelGrids,但影响 dataTables:
.ui-panelgrid > * > tr, .ui-panelgrid > * > tr > td.ui-panelgrid-cell {
border: none;
}
感谢 Kukeltje 在此处发布的答案:Remove all border on all panelgrids not on datatables
【讨论】:
您的 CSS 可能在其他地方被覆盖。
您可以尝试使用!important 规则。
table, table tr, table td {
border: none !important;
}
【讨论】:
!important 不是解决方案。这是一种解决方法。继续阅读CSS specificity, inheritance and cascading rules。 !important 仅应该在您想要覆盖在 HTML 元素的 style 属性中硬编码的样式时使用。这不是这里的情况。
在 primefaces 5.1 上测试
.ui-widget-content {
border: none;
}
【讨论】:
Primefaces 5 中的这项工作
.ui-panelgrid-content {
border: none;
}
【讨论】: