我的页面包含以下标记:
<h:head>
<h:outputStylesheet name="style.css" library="css" />
</h:head>
和某种dataScroller:
<rich:dataScroller for="productsList" id="scroller" maxPages="10">
现在我试图通过添加
来覆盖dataScroller默认的css样式.rf-ds { background: black; }
在我的style.css文件中。
我没有看到任何变化。当我打开firebug时,我看到两个.rf-ds类都来自我的css并被禁用,第二个类是默认的dataScroller类。
如何覆盖默认类?
答案 0 :(得分:2)
尝试像这样添加!对你的css很重要:
.rf-ds {background:black!important; }
答案 1 :(得分:0)
在<link rel="stylesheet" type="text/css" href="/resources/css/style.css" />
中试试<head></head>
从我所看到的情况来看,RichFaces在加载自己的 CSS之后加载了附加了<link>
的CSS,赋予你的 CSS优先权。
在我们的项目中,我们需要定制很多组件的css和IMHO添加!important
并不是一个优雅的解决方案(它更像是一个黑客)。因此我们采用了这种方法。