[英]JSF 2.1 + RichFaces 4 - Change rich:dataScroller default stylesheet
I have the page which has the following tags: 我有一个页面,其中包含以下标记:
<h:head>
<h:outputStylesheet name="style.css" library="css" />
</h:head>
and some kind of dataScroller: 和某种dataScroller:
<rich:dataScroller for="productsList" id="scroller" maxPages="10">
Now I'm trying to override dataScroller default css style by adding 现在我试图通过添加覆盖dataScroller默认的css样式
.rf-ds { background: black; }
in my style.css file. 在我的style.css文件中。
I don't see any changes. 我没有看到任何变化。 When I open firebug I see both .rf-ds classes one is coming from my css and is disabled and second one is default dataScroller class.
当我打开firebug时,我看到两个.rf-ds类都来自我的css并被禁用,第二个类是默认的dataScroller类。
How can I override default class? 如何覆盖默认类?
try to add !important to your css like this: 尝试添加!重要的是你的css像这样:
.rf-ds { background: black !important; .rf-ds {background:black!important; }
}
see http://www.electrictoolbox.com/using-important-css/ 见http://www.electrictoolbox.com/using-important-css/
Try <link rel="stylesheet" type="text/css" href="/resources/css/style.css" />
in your <head></head>
.From what I have seen, RichFaces loads CSS attached with <link>
after it has loaded its own CSS, giving your CSS precedence. 在
<head></head>
尝试<link rel="stylesheet" type="text/css" href="/resources/css/style.css" />
<head></head>
。从我所看到的,RichFaces加载附加的CSS加载了自己的 CSS之后的<link>
,给你的 CSS优先级。 In our project we needed to customize a lot of components's css and IMHO adding !important
is not such an elegant solution (its more like a hack). 在我们的项目中,我们需要定制很多组件的css和IMHO添加
!important
的不是这样一个优雅的解决方案(它更像是一个黑客)。 Hence we took this approach. 因此我们采用了这种方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.