views:

641

answers:

2

I am trying to add a JQueryUI Progress Bar to a page that already has a JQueryUI Tab styled on it. The look of the tab pane and tabs has been already set via the CSS. One of the CSS values .ui-widget-header is also used for the Progress Bar.

How can I make the Progress Bar use a different definition of this CSS style than the one already defined to get teh Tabs to look correctly?

It is specifically the border property I think I need to modify in the .ui-widget-header style. It seems like I could do something with CSS for ID specific tags but I'm not sure how to accomplish this.

Below is an example HTML file that shows the issue. I want the tabs styled the way they are currently, but want to have the Progress Bar styled differently (full border, solid progress meter).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css" type="text/css" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/script&gt;
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"&gt;&lt;/script&gt;
    <title>Test</title>
  </head>
  <body>
<script type="text/javascript" language="javascript">
<!--
//Tabs
$(function(){
    $('#tabs').tabs();
    $("#progressbar").progressbar({ value: 0 });
    setTimeout(updateProgress, 500);
});

function updateProgress() {
  var progress;
  progress = $("#progressbar")
    .progressbar("option","value");
  if (progress < 100) {
      $("#progressbar")
        .progressbar("option", "value", progress + 1);
      setTimeout(updateProgress, 500);
  }
}
// -->
</script>
<style type="text/css">
.ui-widget { font-family: Arial, sans-serif; font-size: 1.1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #ffffff; background: #ffffff}
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #FFFFFF; border-bottom:solid 1px #056B2E; background:none; font-weight:normal;}
 </style>
  <div id="bodycontent">
    <!-- Tabs -->
    <div id="tabs">
      <ul>
        <li><a href="#tabs-1">test 1</a></li>
        <li><a href="#tabs-2">test 2</a></li>
      </ul>
      <div id="tabs-1">
        Test 1 Content
      </div>
      <div id="tabs-2">
       Test 2 Content
      </div>
    </div>
    <br/>
    <br/>
    <div id="progressbar"></div>
  </div>
  </body>
</html>
+1  A: 

You can over-ride the UI styles by simply putting your CSS after the reference to the UI styles. The class for the progress bar is

ui-progressbar-value ui-widget-header ui-corner-left

In your style sheet, you can put:

ui-progressbar-value ui-widget-header {border:1px solid #000000}

This should over-ride the UI style.

qwertypants
That seems to redefine it for the Tabs on the page as well when I place it after the existing ui-widget-header entry. They both share ui-widget-header style. I need the Tab portion to use one style and the Progress Bar to use a different one.
Dougman
Can you post some sample code?
qwertypants
Added the sample code.
Dougman
A: 

I was able to get the desired behavior by adding these CSS entries using an ID selector to override just those values inside my progressbar ID:

div#progressbar.ui-widget-content { border: 1px solid #000000; background:none; font-weight:normal;}
div#progressbar .ui-widget-header { border: 1px solid #000000; background:none; font-weight:normal;}
div#progressbar .ui-progressbar-value {background:#008B3A;}
Dougman
Nice! Please mark your answer as solved for the rest of the community. Thanks.
qwertypants