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 7047607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:47:31+00:00 2026-05-28T02:47:31+00:00

I want to change the size of a PrimeFaces component. For example, a <p:orderList>

  • 0

I want to change the size of a PrimeFaces component. For example, a <p:orderList>. It has a class called ui-orderlist-list which is defined in primefaces.css with a fixed 200×200 dimension. No matter what I do in my theme.css, it is overwritten by this attribute and there is no way I can make the content part of a <p:orderList> wider.

For other components I might want to override just one instance of a component, not all.

Can anyone please tell me how can I do all this?

  • 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-28T02:47:32+00:00Added an answer on May 28, 2026 at 2:47 am

    There are several things you need to take into account of which one or more might be relevant you your specific case

    Load your CSS after PrimeFaces one

    You need to ensure that your CSS is loaded after the PrimeFaces one. You can achieve this by placing the <h:outputStylesheet> referencing your CSS file inside <h:body> instead of <h:head>:

    <h:head>
        ...
    </h:head>
    <h:body>
        <h:outputStylesheet name="style.css" />
        ...
    </h:body>
    

    JSF will automatically relocate the stylesheet to the end of the generated HTML <head> and this will thus ensure that the stylesheet is loaded after the PrimeFaces’ default styles. This way the selectors in your CSS file which are exactly the same as in PrimeFaces CSS file will get precedence over the PrimeFaces one.

    You’ll probably also see suggestions to put it in <f:facet name="last"> of <h:head> which is understood by PrimeFaces-specific HeadRenderer, but this is unnecessarily clumsy and would break when you have your own HeadRenderer.

    Understand CSS specificity

    You also need to ensure that your CSS selector is at least as specific as the PrimeFaces’ default CSS selector on the particular element. You need to understand CSS Specificity and Cascading and Inheritance rules. For example, if PrimeFaces declares a style by default as follows

    .ui-foo .ui-bar {
        color: pink;
    }
    

    and you declare it as

    .ui-bar {
        color: purple;
    }
    

    and the particular element with class="ui-bar" happen to have a parent element with class="ui-foo", then the PrimeFaces’ one will still get precedence because that’s the most specific match!

    You can use the webbrowser developer tools to find the exact CSS selector. Rightclick the element in question in the webbrowser (IE9/Chrome/Firefox+Firebug) and choose Inspect Element to see it.

    Partial overriding

    If you need to override a style for only a specific instance of the component and not all instances of the same component, then add a custom styleClass and hook on that instead. It is another case where specificity is used/applied. For example:

    <p:dataTable styleClass="borderless">
    
    .ui-datatable.borderless tbody,
    .ui-datatable.borderless th
    .ui-datatable.borderless td {
        border-style: none;
    }
    

    If a component does not support a styleClass and you are on jsf 2.2 or up, you can also use passtrough attributes and add a pt:class and have it end-up on the output.

    <p:clock pt:class="borderless" />
    

    Never use !important

    In case you fail to properly load the CSS file in order or to figure the right CSS selector, you’ll probably grab the !important workaround. This is Plain Wrong. It’s an ugly workaround and not a real solution. It only confuses your style rules and yourself more in long term. The !important should only be used in order to override the values hardcoded in HTML element’s style attribute from a CSS stylesheet file on (which is in turn also a bad practice, but in some rare cases unfortunately unavoidable).

    See also:

    • How to reference CSS / JS / image resource in Facelets template?
    • Mozilla Developer Network > CSS > Specificity (great article, a must read!)
    • Understanding Style Precedence in CSS: Specificity, Inheritance, and the Cascade
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to change the font size of Flash's TextArea component which is currently
I'm trying to change background-size using css: I want 100 heights and 100 widths,
This bad boy just does not want to change size to fill the dock
I want to change the size of the actual bar/thumb part of the scrollbar
I want to change the view size for iPhone 3.0, but I find that
I want to be able to do this: the TextView to change its size
I have an array defined as; static double Temp_data[TABLE_SIZE]; I want to change the
I want to change the size of my image in asp.net proportionally, the problem
I want to change the size of the selected cell. But, they shift position
I'm not able to change font size using Jquery. I want to change font

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.