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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:35:58+00:00 2026-06-12T18:35:58+00:00

Given a html fragment of: <button id=foo onclick=window.location.href=’/foo/’; class=ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only btn

  • 0

Given a html fragment of:

<button id="foo" onclick="window.location.href='/foo/';" 
class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only btn btn-primary" type="button" name="btn" id="btn" role="button" aria-disabled="false"><span class="ui-button-text">Join Now »</span></button>

Why are both chrome and mozilla selecting this rule:

.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default{...}

when I want them to select:

.btn .btn-primary .ui-widget .ui-widget-content .ui-state-default .ui-button .ui-button-text-only button,
.btn-primary {...}

Firebug shows both rules getting applied, but no matter how “more selective” I think I’m making the second selector chain, the first selector is shown at the top, and the styles from the second further down the list, all being overridden( strike-thru in firebug UI)

FWIW, I did verify that adding an id based selector does get selected first. I just dont want to have to assign ids all around. As in:

#foo,
.btn-primary {...}

Could anyone help me make the second css selector above be more specific than the first?

This all has to do with a bug I’m finding in the recently released primefaces bootstrap theme which mimics bootstrap styling. In my case, I’m also using the actual bootstrap and would like to apply styles like btn-primary to pf commandButtons etc.

This works fine UNTIL you put a commandButton inside a primefaces Panel…at which point the button styles from the pf theme are clobbering the bootstrap ones. I had thought I could just add a selector to the bootstrap css to get it to take specificity from the pf one…but aparently I’ve got more CSS selector Star Wars to play….http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html

  • 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-06-12T18:36:00+00:00Added an answer on June 12, 2026 at 6:36 pm

    Solved with thanks to BoltClock who gave an important clue.

    In order to get the bootstrap css classes to be selected over the pf theme ones, the selector to add to the bootstrap button-* classes was as such:

    .btn-primary.ui-button
    

    Note the lack of space between the class name and the period. This means select elements having both classes.

    So where the original bootstrap css had:

    .btn-primary {...}
    

    and I simply added another selector to it to include the pf ui-button class.

    .btn-primary.ui-button,
    .btn-primary {...}
    

    Now I am to successfully use the bootstrap btn-primary, btn-info, btn-success, etc as class names the in the PrimeFaces when the button is within a PrimeFaces Panel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following HTML fragment: <span name=foo class=foo-class> <input name=foo value=0 id=foo2_0 type=radio> <label
Given the following HTML fragment: <div class=word> <input type=text name=A /> <input type=text name=n
Given this HTML fragment <ul> <li>Product 1<span><a href=#>Remove</a></span></li> <li>Product 2<span><a href=#>Remove</a></span></li> </ul> What's a
Given the following fragment of html: <fieldset> <legend>My Legend</legend> <p>Some text</p> Text to capture
I'm using jQuery UI to create a button to a given html element. I'm
Given an HTML like following: ...more html above... <div class=any_name> <p>Element A goes here</p>
Given the html fragment <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd> <html xmlns=http://www.w3.org/1999/xhtml
Okay so I have a simple HTML Input fragment: <input id=txtFirstName type=text class=txtBox runat=server
I'm rendering the following html fragment... <div class=navbar navbar-fixed-top> <div class=navbar-inner> <div class=container> <%=
Given the following HTML fragment: <form id=aspnetForm onsubmit=alert('On Submit Run!'); return true;> I need

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.