Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6531259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:51:23+00:00 2026-05-25T09:51:23+00:00

I have a JSF2/Richfaces 4 project in which I want to use one of

  • 0

I have a JSF2/Richfaces 4 project in which I want to use one of the default skins, BUT I also want to set some things’ style using my own custom style sheet. This sounds pretty straightforward, but what I am finding is that in at least some cases, my own style is not being used. To be explicit, here are my relevant web.xml context-params:

<context-param>
    <param-name>org.richfaces.skin</param-name>
    <param-value>blueSky</param-value>
</context-param>
<context-param>
    <param-name>org.richfaces.control_skinning</param-name>
    <param-value>enable</param-value>
</context-param>
<context-param>
    <param-name>org.richfaces.control_skinning_classes</param-name>
    <param-value>enable</param-value>
</context-param>

My CSS file inclusion:

<h:outputStylesheet name="jsp-css.css" library="css" />

One such actual style definition:

.obsOptBtnSel{
background-color: transparent;
background-image: url('/images/circleY.gif');
background-repeat: no-repeat;
background-position: center;
border: none;
text-align: center;
width: 2em;
height: 2em;
}

And the actual button using the style:

<h:commandButton
value="?"
styleClass="#{obs.observation.observationExtent == -1.0 ? 'obsOptBtnSel' : 'obsOptBtnUns'}"
id="unknownButton"
/>

So, one would think that I’d inherit the styles from the blueSky skin where relevant, and then since I’m specifying a style class, any properties mentioned in the custom style sheet would be overridden.

But instead, when I look at the element in Firebug, I see my styleClass getting overridden by that specified by the skin, e.g. it keeps using the blueSky background image instead of mine.

I know I could fix this by simply putting !important after all my styling in the stylesheet, but that seems like a really crappy and unnecessary way to deal with this problem.

What am I doing wrong here? Is there another solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:51:23+00:00Added an answer on May 25, 2026 at 9:51 am

    RichFaces has already a default background specified on the input[type=submit] CSS selector which is a stronger selector than .obsOptBtnSel. There are basically 2 options:

    1. Rename your selector to input[type=submit].obsOptBtnSel to make it yet stronger.

      input[type=submit].obsOptBtnSel {
          background-color: transparent;
          background-image: url('/images/circleY.gif');
          background-repeat: no-repeat;
          background-position: center;
          border: none;
          text-align: center;
          width: 2em;
          height: 2em;
      }
      

      Note, those 4 background properties can be set as a background oneliner with the sub-properties in the order color image position repeat:

      background: transparent url('/images/circleY.gif') center no-repeat;
      
    2. Add !important to the background properties to override all non-!important properties on the same element set by other CSS selectors.

      .obsOptBtnSel {
          background-color: transparent !important;
          background-image: url('/images/circleY.gif') !important;
          background-repeat: no-repeat !important;
          background-position: center !important;
          border: none;
          text-align: center;
          width: 2em;
          height: 2em;
      }
      

      or, shorter,

      background: transparent url('/images/circleY.gif') center no-repeat !important;
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange effect on my JSF2/richfaces 4 project. I use a viewscoped
I have a pretty complex JSF page (we use JSF2 with facelet) in which
I have create a test project with JSF2.0 and richfaces. I am trying to
I have observed an interesting thing in my JSF2.1/Richfaces 4.2 application. Some how all
I use jsf2.0 and java ee6 on a JBoss AS 7 i have a
I am migrating application from JSF1.2/MyFaces+Facelets TO JSF2.1/MyFaces. I have following template which used
I am using JSF2.0 with Richfaces 4.0.0.Final for a web application. I have a
I have a simple JSF+RichFaces form with some fields and obviously a backing bean
I have upgrated to JSF2 but still running with facelet1.1.15. I have these parameters
I added and have been using the faces-config.xml in my Netbeans 6.9/JSF2.0 project due

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.